Title: using client sort on datagrid with pagination Post by: madonna on April 24, 2014, 02:30:03 PM To Whom It May Concern,
I'm using client sort on datagrid but the results look funny. Here are the results: (Sort - Desc) [First 10 records - Page 1]: RecID: -------- 99 9 8 7 14 13 12 11 100 10 [Second 10 records - Page 2]: RecID: -------- 6 5 4 3 2 1 (Sort - Asc) [First 10 records - Page 1]: RecID: -------- 10 100 11 12 13 14 7 8 9 99 [Second 10 records - Page 2]: RecID: -------- 1 2 3 4 5 6 It seems that when it comes to a single digit the logic is fine, but when is more than one digit the logic is acting funny ('fine' in one way but funny). If I set remoteSort="true" it will automatically sort the information in descending order in both pages, but when I hit the column to sort, it will not sort ascending at all - it will always stay as descending. Not sure if the problem might be on my sql statement in where I'm group by and sort the results desc. Comments are welcome! Here is the table code: <table id="dg" class="easyui-datagrid" style="width:755px;height:200px" title="My Data" iconCls="icon-save" pagination="true" pageSize="10" pageList="[10,20,30,40,50]" rownumbers="true" singleSelect="true" striped="true" remoteSort="false" sortName="recid" sortOrder="asc" multipleSort="true"> Title: Re: using client sort on datagrid with pagination Post by: stworthy on April 24, 2014, 06:53:58 PM A better solution to solve your issue is to define your own 'sorter' function for the columns. Please refer to the code below:
Code: <th data-options="field:'f1',width:80,sortable:true,sorter:function(a,b){return parseInt(a) > parseInt(b) ? 1 : -1;}">C1</th> |