You need to sign in to do that
Don't have an account?

Columns Headers of a PageBlockTable not displaying
Hi
Facet not working on my table and I can not find how to make the first column looks as a saleforce row header...
Thanks for your help
<apex:pageBlock >
<apex:pageBlockSection collapsible="true" title="table 1" columns="1">
<apex:PageBlockTable columns="{!colLabels.size+1}"
rows="{!rowLabels.size+1}" value="{!LBItems}" var="it">
<apex:column >
<apex:outputlabel value="{!it.rowlabel}" / >
</apex:column>
<apex:repeat value="{!it.rowBoxIt}" var="rbi">
<apex:column >
<apex:facet name="header" >{!rbi.colLabel}
</apex:facet>
<apex:outputlabel value="{!rbi.name}" / >
</apex:column>
</apex:repeat>
</apex:PageBlockTable>
</apex:pageBlockSection>
This sample code might help you:
<!-- Shows a two column table of contacts associated with the account.
The account column headers are controlled by the facets.-->
<apex:page standardController="Account">
<apex:pageBlock title="Contacts">
<apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!contact.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Phone</apex:facet>
{!contact.Phone}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:page>
Hi,
The default header value displays only when you use <apex:inputfield/> or <apex:outputfield/> in your columns. If you want to display the header value user headerValue attribute in <apex:column/>. If you are using <apex:facet/>, headerValue will not work.
Hi,
I tried both but the headers wont display.
Also <apex:outputlabel value="{!it.rowlabel}" / >
it.rowlabel is a header as well but no idea how to get the salesforce header format.
Thanks for your answers.
Using Facet
<apex:column >
<apex:outputlabel value="{!it.rowlabel}" / >
</apex:column>
<apex:repeat value="{!it.rowBoxIt}" var="rbi">
<apex:column >
<apex:facet name="header">"{!rbi.colLabel}"</apex:facet>
apex:outputlabel value="{!rbi.colLabel}" / >
<apex:inputcheckbox }" >
</apex:inputCheckbox>
</apex:column>
</apex:repeat>
using headerValue
<apex:column >
<apex:outputlabel value="{!it.rowlabel}" / >
</apex:column>
<apex:repeat value="{!it.rowBoxIt}" var="rbi">
<apex:column headervalue="{!rbi.colLabel}" >
apex:outputlabel value="{!rbi.colLabel}" / >
<apex:inputcheckbox }" >
</apex:inputCheckbox>
</apex:column>
</apex:repeat>
Another thy as I just can not find a way to display the titles of my dynamic table.
Thanks for your help
That works well (coltitle displays well)
apex:repeat value="{!colLabels}" var="colTitle">
<apex:column >
<apex:facet name="header" > {!colTitle}
</apex:facet>
...
</apex:column>
</apex:repeat>
this doesn't work (Titles not displayed)
<apex:repeat value="{!it.rowBoxIt}" var="rbi">
<apex:column >
<apex:facet name="header" >{!rbi.colLabel }</apex:facet>
</apex:column>
</apex:repeat>
R using standardcontroller or customcontroller?
<apex:repeat value="{!it.rowBoxIt}" var="rbi">
<apex:column >
<apex:facet name="header" >{!rbi.colLabel }</apex:facet>
</apex:column>
</apex:repeat>
Aariff
Evenever we were using apex:column tags within apex:repeat tag, we were facing this issue. below is sample code:
VF page:
<apex:pageblockSection columns="1" title="Pageblocktable using dynamic visualforce components from Apex">
<apex:dynamicComponent componentValue="{!MyPageBlockTable}" invokeAfterAction="true"/>
</apex:pageblockSection>
Apex Class
public List<oppwrapper> opplist{get;set;}
public class oppwrapper{
public opportunity opp{get;set;}
public List<CompetitorWrapper> complist{get;set;}
public oppwrapper(){
complist=new List<CompetitorWrapper>();
}
}
public class competitorWrapper{
public Competitor__c comp{get;set;}
}
//populate the opplist with values in apex and then use below method to create dynamic pageblocktable...
public Component.Apex.PageBlockTable getMyPageBlockTable(){
Component.Apex.PageBlockTable table=new Component.Apex.PageBlockTable(var='op');
table.expressions.value='{!opplist}';
if(opplist.size()>0){
Component.Apex.pageblocksection pgblksec1 = new Component.Apex.pageblocksection ();
pgblksec1.columns=1;
Component.Apex.inputField inputField1 = new Component.Apex.inputField ();
inputField1 .expressions.value = '{!op.opp.stagename}';
pgblksec1.childComponents.add(inputField1);
Component.Apex.inputField inputField2 = new Component.Apex.inputField ();
inputField2.expressions.value = '{!op.opp.nextstep}';
pgblksec1.childComponents.add(inputField2);
Component.Apex.Column column = new Component.Apex.Column(headerValue=opplist[0].opp.name);
column.childComponents.add(pgblksec1);
table.childComponents.add(column);
if(opplist[0].complist.size()>0){
integer count=0;
for(competitorWrapper comp:opplist[0].complist){
Component.Apex.pageblocksection pgblksec2 = new Component.Apex.pageblocksection ();
pgblksec2.columns=1;
Component.Apex.inputField inputField3 = new Component.Apex.inputField ();
inputField3.expressions.value = '{!op.complist['+count+'].comp.Stage__c}';
pgblksec2.childComponents.add(inputField3 );
Component.Apex.inputField inputField4 = new Component.Apex.inputField ();
inputField4.expressions.value = '{!op.complist['+count+'].comp.nextStep__c}';
pgblksec2.childComponents.add(inputField4 );
Component.Apex.Column column1 = new Component.Apex.Column(headerValue=opplist[0].complist[count].comp.name);
column1.childComponents.add(pgblksec2);
table.childComponents.add(column1);
}
}
}
return table;
}
Thanks,
<apex:repeat value="{! displayColumList}" var="col">
<apex:column headerValue="{!col}" rendered="{! col=='Action'}" >
<apex:inputCheckbox value="{!l.IsSelected}">
<apex:actionSupport event="onchange" rerender="totalSelected" />
</apex:inputCheckbox>
</apex:column>