To enable the sort column and direction, simply include the col server variable in the example in the URL pattern:
ajaxUrl : "http:/mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}",
{page} is the current page the user is viewing, and {size} is the number of lines displayed in the browser.
Enable &{sortList:col} (with col server-side variable matching for column and sort direction) to enable sorting. And enable &{filterLost:fcol} (with fcol matching varibale on the server side to filter columns) to enable any filtering. The pager plugin formats the string at &col[2]=0&col[3]=0 (or something else) for you.
If you look at the ajaxProcessing function, all it does is reformat the ajax data from your server from the current rowset to display (not all rows) to fit this required format:
// process ajax so that the following information is returned: // [ total_rows (number), rows (array of arrays), headers (array; optional) ] // example: [ 100, // total rows [ [ "row1cell1", "row1cell2", ... "row1cellN" ], [ "row2cell1", "row2cell2", ... "row2cellN" ], ... [ "rowNcell1", "rowNcell2", ... "rowNcellN" ] ], [ "header1", "header2", ... "headerN" ] // optional ]
If you have an undetermined number of rows in your database, just return 0 ... it should still work, but then the variables totalPages and totalRows will be inaccurate.
source share