onBeforeSort
fires before sorting of the dataset
function onBeforeSort( // the template of the sort-by field by: string/function/undefined, // the direction of sorting dir: string/undefined, // the type of sorting as: string/function): boolean
Returns
Section titled “Returns”boolean
returning false will prevent sorting
Example
Section titled “Example”grid.data.attachEvent("onBeforeSort", function(by, dir, as){ //... some code here ...});
Details
Section titled “Details”Returning false from the event handler will block further processing, and data will not be sorted.
If the third param is a function, the parameters of such a function are the following:
- a (object) - the first data item
- b (object) - the second data item
- prop(string) - the name of the field that the data will be sorted by.
grid.sort("#fieldName#", "desc", function(a, b, prop) { return a[prop] - b[prop];})
See also
Section titled “See also”Articles
API