仅用于模态的 jqGrid 隐藏属性
jqGrid Hidden Attribute for Modal Only
我使用模式弹出窗口来添加新记录,但我使用内联来编辑当前记录。添加新记录时,我想隐藏模式弹出窗口中的一些列。
如果我将一列设置为 hidden: true 或 editable: true 那么它也不会出现在网格中。在添加模型弹出窗口中隐藏列但仍让它们显示在网格中的最佳方法是什么?
Oleg 的回答更新(将可编辑属性设置为函数并测试隐藏):
{
key: false, name: 'FINAL_DT', index: 'FINAL_DT',
editable: true, formatter: 'date',
formatoptions: { newformat: 'm-d-Y' },
formoptions: {},
editrules: { custom: true, custom_func: validDateCheck },
editable: function (options) {
if (options.mode === "addForm")
{
hidden = true;
}
},
editoptions: {
dataInit: function (element) {
$(element).datepicker({
id: 'finalDt_Datepicker',
dateFormat: 'mm-dd-yy',
//minDate: new Date(2010, 0, 1),
maxDate: new Date(2020, 0, 1),
showOn: 'focus'
});
}
}
}
解决方案取决于 jqGrid 的版本和您使用的分支。最简单的解决方案是在本地升级到 free jqGrid (it's the fork, which I develop). If you installed old version via NuGet, then you should uninstall it and install free jqGrid from here. You can use it from CDN or download 的最新版本 (4.13.1)。
免费的 jqGrid 允许将 editable
属性定义为一个函数。有关详细信息,请参阅 the wiki article。如果 options.mode === "addForm"
.
,您可以从 editable
回调中测试 return "hidden"
值
我使用模式弹出窗口来添加新记录,但我使用内联来编辑当前记录。添加新记录时,我想隐藏模式弹出窗口中的一些列。
如果我将一列设置为 hidden: true 或 editable: true 那么它也不会出现在网格中。在添加模型弹出窗口中隐藏列但仍让它们显示在网格中的最佳方法是什么?
Oleg 的回答更新(将可编辑属性设置为函数并测试隐藏):
{
key: false, name: 'FINAL_DT', index: 'FINAL_DT',
editable: true, formatter: 'date',
formatoptions: { newformat: 'm-d-Y' },
formoptions: {},
editrules: { custom: true, custom_func: validDateCheck },
editable: function (options) {
if (options.mode === "addForm")
{
hidden = true;
}
},
editoptions: {
dataInit: function (element) {
$(element).datepicker({
id: 'finalDt_Datepicker',
dateFormat: 'mm-dd-yy',
//minDate: new Date(2010, 0, 1),
maxDate: new Date(2020, 0, 1),
showOn: 'focus'
});
}
}
}
解决方案取决于 jqGrid 的版本和您使用的分支。最简单的解决方案是在本地升级到 free jqGrid (it's the fork, which I develop). If you installed old version via NuGet, then you should uninstall it and install free jqGrid from here. You can use it from CDN or download 的最新版本 (4.13.1)。
免费的 jqGrid 允许将 editable
属性定义为一个函数。有关详细信息,请参阅 the wiki article。如果 options.mode === "addForm"
.
editable
回调中测试 return "hidden"
值