在免费的jqgrid中,在beforeSelectRow
事件中单击一行即可开始行内联编辑。
因此不需要动作列中的内联编辑按钮。
我尝试通过在格式选项中设置editbutton = false
来删除它:
cm= [{
"name":"_actions",
"template":"actions",
"formatoptions":{"editbutton":false,
"delbutton":true,
"delOptions":{"url":"Delete",
"afterComplete":function (response, postdata, formid) {
$grid[0].focus();
}
}}}
在这种情况下,在内联编辑期间,保存和取消按钮也不会出现在操作列中。内联编辑时,操作列为空。
如果禁用编辑操作按钮,如何启用保存和取消操作按钮?
答案 0 :(得分:2)
我想你的意思是保存,按钮应该包含在formatter: "action"
中,但是要隐藏,直到编辑将在行中开始(通过inlineNav
的使用按钮,通过选择行或通过其他方式)。您可以通过使用isDisplayButtons
回调在免费的jqGrid中执行此操作(请参阅the answer)。该列的以下定义可以解决这个问题
{
name: "_actions",
template: "actions",
formatoptions: {
editbutton: false,
isDisplayButtons: function (opts, rwd, act) {
return {
save: { display: true },
cancel: { display: true }
};
}
}
}
请参阅the demo:
通常,您可以使用
在所有行中显示可见的“保存”按钮{
name: "_actions",
template: "actions",
formatoptions: {
editbutton: false,
isDisplayButtons: function (opts, rwd, act) {
return {
save: { display: true, hidden: false },
cancel: { display: true }
};
}
}
}
(请参阅the next demo),但在保存行更改后,保存按钮将被隐藏,因为formatter: "actions"
会将按钮的可见性与行的当前状态同步: