Tablesorter does not sorting on initial page load

时间:2015-06-30 19:20:00

标签: javascript jquery sorting tablesorter

I have implemented client side sorting for the gridview using Jquery TableSorter. But when my page the page loads for the first time, it is not displaying in the sorted order. I have to click on the header to display in the ascending order. I’m allowing sortable option on only 2nd column. Implemented with SortList

$("#<%=gvDetails.ClientID%>").tablesorter({
                sortList: [2, 0],
                headers: {        
                    0: { sorter: false },
                    1: { sorter: false },
                    3: { sorter: false },
                    4: { sorter: false }
                }
            });

I'm getting this error:

JavaScript runtime error: Unable to set property 'count' of undefined or null reference

Can someone please suggest mw how to solve this. Thanks!

1 个答案:

答案 0 :(得分:0)

我无法判断您正在使用哪个版本的tablesorter,但sortList option *需要使用数组数组(demo)进行设置:

$('table').tablesorter({
    sortList: [ [0,0], [1,1] ]
});

* sortList链接指向我的fork of tablesorter,但原始广告和广告投放的选项设置相同。