Sorting on the server is ideal. If you still need to sort the data, you can use the onLoadSuccess event. Then you could call the sort method. For example;
$('#dg').datagrid({
onLoadSuccess: function(){
$('#dg').datagrid('sort', {
sortName: 'date',
sortOrder: 'desc'
});
},
fit: true,
nowrap: true,
striped: true,
collapsible: true,
columns: [[
{ field: 'date', title: 'Date', width: 120, sortable: true, sorter: function (a, b) { return (a > b ? 1 : -1); } },
{ field: 'name', title: 'Name', width: 120, sortable: true, sorter: function (a, b) { return (a > b ? 1 : -1); }}
]]
});