Array of sort objects (submitted to data source for record sorting).
Array, default = []
If user clicks on the column (or holds shift key and clicks several columns) and if the column is sortable, the grid will generate sort objects and submit it to the data source to apply sorting.
As a developer you can define initial sorting during object creation. $('#grid').w2grid({ name : 'grid', columns: [ { field: 'recid', caption: 'ID', size: '50px' }, { field: 'lname', caption: 'Last Name', size: '30%' }, { field: 'fname', caption: 'First Name', size: '30%' }, { field: 'email', caption: 'Email', size: '40%' }, { field: 'sdate', caption: 'End Date', size: '120px' } ], records: [ { recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' }, { recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' }, { recid: 3, fname: 'Jin', lname: 'Franson', email: 'jdoe@gmail.com', sdate: '4/23/2012' }, { recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '5/3/2012' }, { recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' }, { recid: 6, fname: 'Francis', lname: 'Gatos', email: 'vitali@gmail.com', sdate: '2/5/2012' } ], sortData: [ { field: 'lname', direction: 'asc' }, { field: 'fname', direction: 'asc' } ] }); You can also change sorting form JavaScript during run-time by changing this array. Do not forget to call .refresh method to refresh them on the screen. If you data source is local the grid will sort the records using this .sortData array. If the data source is remote, the gird will submit .sortData array to the server for sorting.
The structure of the sort object is: sort = { field : '', // sort field name direction : 'asc', // direction of the sort (asc or desc) } If user clicks the same column second time the sort direction will be reversed. If you want to make a column unsortable, set .sortable property of the column object to false.