function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dev87Dev87 

visualforce Page - Sort Columns

Hello, I have a table in my visualforce page and I need to sort on some column like this:
    <apex:column >                                                                                            
                        <apex:facet name="header" >
                            <apex:commandLink action="{!empty}">
                              <apex:outputText value="Type d'inscription" />
                              <apex:outputText escape="false" rendered="{!sortBy=='Type d\'inscription'&&sortDir=='ASC'}">
                                <img src="/s.gif" alt="Sorted Ascending" class="sortAsc" title="Sorted Ascending" />
                              </apex:outputText>
                              <apex:outputText escape="false" rendered="{!sortBy=='Type d\'inscription'&&sortDir=='DESC'}">
                                <img src="/s.gif" alt="Sorted Descending" class="sortDesc" title="Sorted Descending" />
                              </apex:outputText>
                              <apex:param value="Type d'inscription" name="column" assignTo="{!sortBy}" />
                              <apex:param value="{!IF(sortDir=='ASC'&&sortBy=='Type d\'inscription', 'DESC', 'ASC')}" name="direction" assignTo="{!sortDir}" />
                            </apex:commandLink>
                        </apex:facet>                        
                        <apex:outputText value="{!cmber.campMember.Type_d_inscription__c}" rendered="{!cmber.campMember.Type_d_inscription__c != null}"/>
             <apex:outputText value="-" rendered="{!cmber.campMember.Type_d_inscription__c == null}"/>                        
                    </apex:column>

When I try to sort, the number of columns decreases( juste 3 lines appears from 10 lines)
Can u help me
Avishek Nanda 14Avishek Nanda 14
Hi Dev,

Please find thsi blog where Srini has explained with the example. 
http://sfdcsrini.blogspot.com/2014/09/sorting-tables-in-visualforce.html

Easiest way would be using Jquery if you are familir. 

Regards,
Avishek Nanda
Dev87Dev87
Hello Avishek Nanda, 
Thank you  for your response, but in my case, I want to sort columns when I clic on the name of the column.
I have 10, columns and this problem only appears with 2 columns (picklist fields)