我想知道如何确保在从服务器加载数据后 id 列隐藏在网格中,但是在选择一行中的任何可见单元格时应该可以使用 id 值。
来自服务器的数据看起来像;
{ "rows": [
[ "0007A53CEC393D2CC1257BE3002AAC36","Name1","Telephone1","Mobile1","Workplace1" ] ,
[ "0007A53CEC393D2CC1257BE3002AAC36","Name2","Telephone2","Mobile2","workplace2" ]
]}
网格代码看起来像;
// Load the grid
$( "#contentTable" ).jqGrid( {
url: jsonURL,
datatype: 'json',
autowidth: true,
height: 520,
colNames: options.selectedColumnNames,
colModel: options.selectedColumnModel,
loadonce: true,
rownumbers: true,
rownumWidth: 40,
gridview: true,
pager: '#pager',
viewrecords: true,
sortorder: "asc",
jsonReader : {
cell: "",
id: "0"
},
caption: options.viewTitle
});
列模型看起来像;
columnNames = ['ID', 'Namn','Telefon', 'Mobil', 'Arbetsplats'];
columnModel = [
{name:'id',index:'name', width: 200},
{name:'name',index:'name', width: 200},
{name:'telephone',index:'telephone', width:100},
{name:'mobile',index:'mobile', width:100},
{name:'workplace',index:'workplace', width:200}
];
我的问题是,任何人都可以帮我弄清楚我应该如何隐藏 id 列而不显示在网格中,但我希望在连续选择一个 cel 时仍然能够获取 id 值?