Hi guys,
I’m trying to presort a column in the grid when it’s rendered. I’ve written it like this:
$('#jqxgrid').on('bindingcomplete', function (event) {
$("#jqxgrid").jqxGrid({'sortby', 'lastname', 'asc'});
});
var adapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({
width: 500,
theme: 'energyblue',
source: adapter,
sortable: true,
selectionmode: 'singlecell',
columns: [{
text: 'First Name',
datafield: 'firstname',
columngroup: 'Name',
width: 90
}, {
text: 'Last Name',
columngroup: 'Name',
datafield: 'lastname',
width: 90
}, {
text: 'Product',
datafield: 'productname',
width: 170
}, {
text: 'Order Date',
datafield: 'date',
width: 160,
cellsformat: 'dd-MMMM-yyyy'
}, {
text: 'Quantity',
datafield: 'quantity',
width: 80,
cellsalign: 'right'
}, {
text: 'Unit Price',
datafield: 'price',
cellsalign: 'right',
cellsformat: 'c2'
}]
});
When I run the fiddle: , I don’t get any result
You probably recognize the code because I forked your bindingcomplete fiddle and changed the action to sortby instead of alert. I tried adding your public jqxgrid.sort.js (although I suspect that jqx-all.js has that already), but there was no change in the behaviour.
Can you have a peek and let me know if there’s something obvious wrong with how I’m trying to do this? Thanks!