【发布时间】:2012-01-18 09:05:46
【问题描述】:
我的问题是我想根据选择要编辑的行的单元格的内容来更改编辑表单中可编辑的单元格或不可编辑的单元格。 我在此链接中使用了 Oleg 的示例:JQGrid: Dynamically set a cell to uneditable based on content 来弄清楚如何将单元格从可编辑更改为不可编辑,但我无法获取单元格值以进行比较并决定是否要更改单元格的编辑选项。
更新代码:
var Setcelluneditable=function(form) {
return function (form) {
var id = jQuery(list).getGridParam('selrow');
var ret = jQuery(list).jqGrid('getRowData',id);
alert("Arrived="+ret.Arrived);
if (ret.Arrived=='Yes')
{alert("hello"+id);
jQuery(list).setCell(id,'Arrived','',{color:'red'}, editable:'0'});}
}
};
jQuery(list).jqGrid('navGrid',pager,{edit:true,add:true,del:true,search:false,view:true, reload:true},
{
width:colwidth,
height:"auto",
reloadAfterSubmit:true,
closeAfterEdit: true,
recreateForm: true,
ajaxEditOptions: {cache: false},
beforeInitData : Setcelluneditable("#editmod")
},
{
width:colwidth,
height:"auto",
reloadAfterSubmit:true,
closeAfterAdd: true,
recreateForm: true,
drag: false
},
{},
{},
{},
{});
这似乎不起作用,因为我更改了已经构建的网格。
【问题讨论】: