I have implemented table sorting with the help of jquery tablesorter. Everything works fine, except that one of the row in one the column is not sorting properly. I tried all options mentioned in the table sorter website.

tablesorter demo

<apex:datatable value="{!projectAssetsWrapperList}" var="a" id="theaddrs" styleClass="tablesorter">
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Task_Type}" width="90px">
         <apex:outputText value="{!a.tasktypewrap}" />
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Sent_to_Click}" width="90px">
         <apex:outputText value="{!a.senttoclickwrap}" />
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Planned_Asset_Product_Description}" width="240px">
         <apex:outputText value="{!a.plannedAsstProdDescwrap}" />
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Planned_Asset_Serial_Number}" width="190px">
         <apex:outputText value="{!a.plannedAsssetSrnowrap}" />
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Planned_Asset_Product_Number}" width="190px">
         <apex:outputText value="{!a.plannedAssetPrnowrap}" />
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Installed_Asset_Serial_Number}" width="180px">
         <apex:outputText value="{!a.installedAssetSrnowrap}" />
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Installed_Asset_Product_Number}" width="190px">
         <apex:outputText value="{!a.installedAssetPrnowrap}" />
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Installation_date}" width="110px">
         <apex:outputText value="{!a.installationdatewrap}" /> 
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Subtask_Name}" width="200px">
         <apex:commandLink value="{!a.subtasknamewrap}" action="{!loadProjectTask}" target="_blank">
           <apex:param assignTo="{!projectTaskId}" value="{!a.subtaskidwrap}" name="taskId"/>                                                                             
       <apex:column headerValue="{!$Label.GSD_SRM_Assets_Table_Resource_Type}" width="120px">
         <apex:outputText value="{!a.resourceType}" /> 

enter image description here

  • As Ilya suggests, the most likely cause is that the "Subtask Name" that sorts incorrectly is different in some way i.e. the problem is with the data not the code. Use your browser's "Inspect" feature to see the exact text - HTML merges spaces so extra spaces would be hidden.
    – Keith C
    May 3, 2016 at 9:35

1 Answer 1


I think that I can reproduce your bag:

You are displaying your text as a link. If you have space between words - they will be changed to underscore symbols. If you refer to ASCII table , you can see that space is &#32 and underscore is &#95.

Thats why tablesorter places Letter B before Letter_A.

Try to inspect your table elements in table and compare they innerHtmls:

<a href="http://example.com">
    Letter B

<a href="http://example.com">
  • Check page source, you also could have couple of spaces, but browser displays only one May 3, 2016 at 4:48
  • all the values ''Asset explorer Subtask 1 Test'' in the table are getting from single variable so there will not be any changes. I also checked it but i didn't find any changes May 3, 2016 at 5:38
  • I've checked tablesorter, it works from the box. library sorts lines by td values. could you find a way to attach your page source? May 3, 2016 at 6:00
  • hi lepesh i have added my source code pls go trou it once... May 3, 2016 at 6:25
  • I mean page source. in firefox yon can click right button on page and select view page source. I'm curious what page stores itself. May 3, 2016 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .