How do I disable column sorting in jQuery Grid plugin?
I would like to disable sorting, and enable altRows in jQuery Grid plugin. Here's my clientside code:
var myGrid = $("#list").jqGrid({
url: '/Home/GetData/',
datatype: 'json',
mtype: 'GET',
colNames: ['Id', 'Description'],
colModel: [
{ name: 'Id', width: 40 },
{ name: 'Description', width: 400}],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortable: false,
altRows: true,
viewrecords: true,
caption: 'My first grid'
});
My server-side controller action signature is:
public ActionResult GetData(string sidx, string s开发者_如何学编程ord, int page, int rows)
So far sorting is still enabled, and there's no altRows highlighting. I'm sure it's something terribly obvious that I missed but can't for the life of me figured out what.
Any ideas please?
Thanks, D.
In your column model, set each column's sortable
to false.
colModel: [
{ name: 'Id', width: 40, sortable: false },
{ name: 'Description', width: 400, sortable: false }]
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options
For alternating rows, look at altRows
and altclass
property options on the grid:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options
find Sort in the js turn it to false
Sort: false
精彩评论