Forum


17:58

24/05/2010

I am having trouble with sorting columns. Even though i disable some columns to not be sortable, when i click on them, they go away to the server to sort.
Below is the standard settings i use for all my grids:
$.jgrid.defaults = $.extend($.jgrid.defaults, {
autowidth: true,
datatype: 'json',
gridview: true,
height: 'auto',
imgpath: '/Content/Images/JQuery-UI',
jsonReader: {
id: 'Id',
page: 'Page',
total: 'Total',
records: 'Records',
repeatitems: false,
root: 'Rows',
userdata: 'UserData'
},
loadui: 'block',
mtype: 'GET',
multiboxonly: true,
multiselect: true,
pager: '#pager',
rowNum: 10,
rowList: [10, 20, 30, 40, 50, 100],
sortorder: 'asc',
viewrecords: true
});
}
I then have custom settings for the actual grid on the page:
$.jgrid.defaults = $.extend($.jgrid.defaults, {
colNames: ['', 'Identifier', 'Title', 'Category', 'CurrentLocation', 'CurrentOwner', 'Status'],
colModel: [
{ name: 'Id', index: 'Id', editable: false, hidden: true, key: true },
{ name: 'Identifier', index: 'Identifier', editable: false, hidden: false, sort: true },
{ name: 'Title', index: 'Title', editable: false, hidden: false, sort: true },
{ name: 'Category', index: 'TrackedItemCategory.Description', editable: false, hidden: false, sort: true },
{ name: 'Location', index: 'Location', editable: false, hidden: false, sort: false },
{ name: 'Username', index: 'Username', editable: false, hidden: false, sort: false },
{ name: 'Status', index: 'Status', editable: false, hidden: false, sort: true }
],
sortname: 'Identifier',
url: 'GetDataAsJson',
multiselect: false,
loadComplete: function(xhr) {
var userData = $('#grid').getGridParam('userData');
if (userData) {
displayErrorMessage(userData);
}
},
loadError: function(xhr, status, error) {
window.location.replace('Exception/HandleException');
}
});
},
And finally, load the grid:
var lastsel;
grid.jqGrid({
onSelectRow: function(id) {
lastsel = selectedRow(id, lastsel);
}
});
}
As you can see, 2 columns are not sortable, but are still clickable.
Any ideas what i am doing wrong? or is this a feature?
Cheers.
Most Users Ever Online: 715
Currently Online:
83 Guest(s)
Currently Browsing this Page:
2 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66