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
edoardo_spanoedoardo_spano 

Sorting apex:dataTable without APEX

Hi all,

I need to sort an apex:dataTable, but I have a Professional Edition environment, so I can't write APEX code.
There is a way to do this?

Thanks in advance
Best Answer chosen by edoardo_spano
edoardo_spanoedoardo_spano
Hi Ramu,

Thank you for the reply.
However I have found a solution using JQuery.

Below my working solution:
<apex:page ..........>

    <apex:includeScript value="//code.jquery.com/jquery-1.11.1.min.js"/>
    <apex:includeScript value="//cdn.datatables.net/1.10.3/js/jquery.dataTables.min.js"/>

    <apex:pageBlock>
        <apex:dataTable id="theTable" ............>
        // the columns
        </apex:dataTable>
    </apex:pageBlock>

    <script>
    $(document).ready(function() {
        $("[id$='theTable']").dataTable( {
            "order": [[ 1, "desc" ]]    // specify the index of column that you want sort (index start by 0) and if you want an asc or desc sort
        } );
    } );
    </script>

</apex:page>

Bye
 

All Answers

RamuRamu (Salesforce Developers) 
Nope, I do not think there is any alternative for this as it is set as a standard salesforce edition limit as per the below article

http://www.salesforce.com/us/developer/docs/packagingGuide/Content/dev_packages_apex_ge_pe.htm
edoardo_spanoedoardo_spano
Hi Ramu,

Thank you for the reply.
However I have found a solution using JQuery.

Below my working solution:
<apex:page ..........>

    <apex:includeScript value="//code.jquery.com/jquery-1.11.1.min.js"/>
    <apex:includeScript value="//cdn.datatables.net/1.10.3/js/jquery.dataTables.min.js"/>

    <apex:pageBlock>
        <apex:dataTable id="theTable" ............>
        // the columns
        </apex:dataTable>
    </apex:pageBlock>

    <script>
    $(document).ready(function() {
        $("[id$='theTable']").dataTable( {
            "order": [[ 1, "desc" ]]    // specify the index of column that you want sort (index start by 0) and if you want an asc or desc sort
        } );
    } );
    </script>

</apex:page>

Bye
 
This was selected as the best answer