在我的jqGrid中,我想从模型中传入5行,并在网格中显示其中的3个,但所有5个都显示在编辑中并添加jqGrid生成的弹出窗口。我知道我可以在colModel
设置中添加hidden: true
属性,以防止它显示出来,但这也会从弹出窗口中隐藏它。是否有某种方法隐藏网格中的列,但在添加或编辑数据时显示它?隐藏jqGrid显示的列,但在编辑/添加屏幕中显示它?
我的网格代码:
<script type="text/javascript">
$(document).ready(function()
{
$('#Sections').jqGrid({
url: '@Url.Action("GetData")',
datatype: 'json',
mtype: 'GET',
colNames: ['ID', 'RouteName', 'Title', 'File', 'Description'],
colModel: [
{ name: 'ID', index: 'ID', width: 10, sorttype: 'int' },
{ name: 'RouteName', index: 'RouteName', width: 50, editable: true, edittype: 'text'},
{ name: 'Title', index: 'Title' },
{ name: 'File', index: 'File', hidden: true },
{ name: 'Description', index: 'Description', hidden: true }
],
autowidth: true,
height: '100%',
pager: $('#SectionsPager'),
sortname: 'ID',
viewrecords: true,
loadonce: true,
ignoreCase: true,
multiSort: true,
});
$('#Sections').jqGrid('navGrid', '#SectionsPager',
//enabling buttons
{ add: true, del: false, edit: true, search: true },
//add options
{ width: 'auto' },
//edit options
{ width: 'auto' },
//delete options
{}
);
});
</script>
你在哪里关闭'eddithidden'需要设置为'true'不是false,如果你更新了你的答案,我会将它标记为正确的。 – Matthew
@MatthewVerstraete完成 – Mark