我有一个jqgrid代码如下。我想在colmodel中添加一个自定义属性,与下面的代码中的 myproperty 相同。
...
jQuery("#list2").jqGrid({
url:'myurl',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90, myproperty:{prop1:'true', prop2:1}},
{name:'name',index:'name asc, invdate', width:100, myproperty:{prop1:'false', prop2:2}},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pager2',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"JSON Example"
});
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
需要这是因为我想将一些属性传递给每一列,然后按如下方式获取。让我说我想要我的属性为第1行。我会这样做
var rowId=1
var colmodel= jQuery("#list2").jqGrid('getGridParam', 'colModel');
var myProperty = colmodel[rowid].myproperty;