Controller :  public class testPageController{     public List accList{get;set;}     public testPageController(){         accList  = [select id,name from account];     }           } Just download the zip file from \" http://tablesorter.com/__jquery.tablesorter.zip \" , rename the zip file as \"sorter.zip\" , create a static resource named \"sorter\" and upload this zip file there then this code will work. ", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T49uLSAR", "datePublished": "2015-06-08T09:51:00.000Z", "author": { "@type": "Person", "name": "Sachin Kadian", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000DpW14QAF", "affiliation": { "@type": "Organization", "name": "Codearth" } } }, "suggestedAnswer": [] } } Skip to main content
Hi,

I want to add the possibility to sort a table in my visualforce. I found the TableSorter JavaScript to add the sortfunction, but I don't know how can I add this to my page. I've download the script http://tablesorter.com/docs/⌗Download and get a zip-file. I now I have to upload the javascript to my org --> static rescources. 

But how to upload the file, zipped? or unzipped? If unzipped, which files are necessary?

Thanks for your help,

Sascha
4 answers
  1. Jun 8, 2015, 9:51 AM
    Here I wrote some code for you..

    VF Page : 

     <apex:page controller="testPageController">

      <apex:includeScript value="{!URLFOR($Resource.sorter, '/jquery-latest.js')}"/>

      <apex:includeScript value="{!URLFOR($Resource.sorter, '/jquery.tablesorter.min.js')}"/>

      <apex:pageBlock>

          <apex:pageBlockTable value="{!accList}" var="acc" styleClass="accTable">

              <apex:column value="{!acc.Id}"/>

              <apex:column value="{!acc.Name}"/>

          </apex:pageBlockTable>

      </apex:pageBlock>

      

      <script>

          $(document).ready(function() { 

                    $(".accTable").tablesorter(); 

          }); 

      </script>

       </apex:page>

    Controller : 

    public class testPageController{

        public List<Account> accList{get;set;}

        public testPageController(){

            accList  = [select id,name from account];

        }

        

        

    }

    Just download the zip file from "http://tablesorter.com/__jquery.tablesorter.zip" , rename the zip file as "sorter.zip" , create a static resource named "sorter" and upload this zip file there then this code will work. 
0/9000