[英]How do I disable column sorting in jQuery Grid plugin?
I would like to disable sorting, and enable altRows in jQuery Grid plugin. 我想禁用排序,并在jQuery Grid插件中启用altRows。 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 sord, int page, int rows)
So far sorting is still enabled, and there's no altRows highlighting. 到目前为止,排序仍处于启用状态,并且没有altRows高亮显示。 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. 感谢:D。
In your column model, set each column's sortable
to false. 在列模型中,将每列的
sortable
设置为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 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options
For alternating rows, look at altRows
and altclass
property options on the grid: 对于交替的行,请查看网格上的
altRows
和altclass
属性选项:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options
在js中找到Sort将其设置为false
Sort: false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.