+ Start a Discussion
loneboatloneboat 

commandLink not rendering in header facet if there is anything after it in the facet

In my dataTable, the following WORKS how I expect:

 

                    <apex:column value="{!a.maxStage}">
                        <apex:facet name="header">
                            <apex:commandLink action="{!sortAccounts_maxStage}" value="Stage" reRender="accountTable" status="accountsTableAjaxStatus" />                            
                        </apex:facet>
                    </apex:column>

 

However, if I add even a SINGLE character after the commandLink, the whole commandLink stops rendering:

 

                     <apex:column value="{!a.maxStage}">
                        <apex:facet name="header">
                            <apex:commandLink action="{!sortAccounts_maxStage}" value="Stage" reRender="accountTable" status="accountsTableAjaxStatus" />
                            x
                        </apex:facet>
                    </apex:column>

 

Note the added "x".  Same behavior if I wrap the "x" in a SPAN tag or apex:outputText/etc.

 

Any ideas why?  I already tried forcing rendering with rendered="true" on the facet.

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

I should have said apex:outputPanel,  not apex:panelGroup,  sorry.   I keep getting those two confused. 

All Answers

loneboatloneboat

Interestingly, if I put the "x" BEFORE the commandLink, the commandLink renders just fine, and the "x" does not get rendered.

aballardaballard

I think apex:facet only handles a single component (the last one, apparently).  If you want more than one item in it you need to use apex:panelgroup to group them into one. 

 

(Seems like a bug... it should either handle this situaiton or issue a compile-time error when you try to save a page that has more than one item in a facet.... )

loneboatloneboat

Hmmm. According to the docs, an apex:panelgroup must be a child component of an apex:panelGrid.  My VF is a dataTable, not a panelGrid.

aballardaballard

I should have said apex:outputPanel,  not apex:panelGroup,  sorry.   I keep getting those two confused. 

This was selected as the best answer
loneboatloneboat

That fixed it - thanks for your time!