I am using a wrapper class to combine an sObject with a checkbox, then iterating over the wrappers in my list. The first column displays the checkbox, then a repeat tag iterates over a list of strings derived from the object fieldNames, allowing the table to render columns according to the object's fieldSet.
the 'fieldSetList' is a list of field Names and I'm using a dynamic APEX process so that the client can reconfigure their table by changing the value and their order in the field set on the custom object.
The table displays correctly, however I want to be able to sort the table by clicking on the column. To do this, I have tried to add an onclick call to an ActionFunction ('sortCLTable') to the column and sending the repeat tag's interation variable ('f') as a parameter: 'onclick="sortCLTable(f)"'
The ActionFunction's parameter should set the sortValue property in the controller, and run the sorttable method, but alas it does not. The table columns have no response whatsoever.
<apex:page ...>
<apex:form>
<apex:outputPanel id="thePanel">
<apex:pageBlockTable value="{!CLWraps}" var="CLWrap">
<apex:column headervalue="Select" >
<apex:inputCheckbox value="{!CLWrap.selectbox}"/>
</apex:column>
<apex:repeat value="{!fieldSetList}" var="f" >
<apex:column value="{!CWrap.CL[f]}" onclick="sortCLTable(f)"/>
</apex:repeat>
</apex:pageBlockTable>
</apex:outputPanel>
<apex:actionFunction action="{!sortTable}" name="sortCLTable" reRender="thePanel">
<apex:param name="firstParam" assignTo="{!sortValue}" value="" />
</apex:actionFunction>
</apex:form>
</apex:page>
CONTROLLER contains:
public string sortValue {get; set;}
public pageReference sortTable(){
resetQueryWithSortValue(sortValue);
return null;
}
Although the 'f' is working to set the column header (as its referencing a sObject field). it doesn't appear to be passing as a parameter to the apex:Param value associated with the function, or to the controller's corresponding property. I think I've written the page tags correctly...
Using ActionSupport instead appears to mess up the repeat function such that the column names no longer appear - not sure why...
I can add more code if needed, but figured this would describe the problem. Any help is much appreciated.
Thanks
VeMan