jQGrid,如何使列在添加对话框中可编辑,但在(内联)编辑期间不可编辑
我有一个 jQGrid,其中有一列,我只想在添加新行时可编辑该列。
我已经看到了当编辑和添加都在对话框中发生时如何执行此操作的示例,但是有没有办法通过内联编辑来执行此操作?
我尝试在 beforeShowForm: 中使用 grid.setColProp() ,但这不起作用(该列保持只读状态,并且不存在于添加对话框中)。
基于对话框的列启用/禁用示例:
http://www.ok-soft-gmbh.com/jqGrid/CustomFormEdit.htm
I have a jQGrid with a column that I only want to be editable when adding a new row.
I've seen examples of how to do this when edits and adds are both happening in a dialog but is there a way to do this with in-line editing?
I've tried using grid.setColProp() in beforeShowForm:, but this doesn't work ( the column remains read only and is not present in the add dialog).
Example of dialog based column enable/disable:
http://www.ok-soft-gmbh.com/jqGrid/CustomFormEdit.htm
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为您使用我旧答案中的示例(这个和这个)我觉得我也应该回答你的问题。
在旧示例中的所有字段,可以在添加或编辑对话框,具有属性
editable:true
。仅应在“添加”对话框中显示的字段将隐藏在 beforeShowForm 事件句柄。同样地,我们可以在调用 editRow 方法之前临时将某些字段切换为editable:false
并立即重置回editable:true
通话后:您可以在此处查看此实时内容。
更新: 免费 jqGrid 允许定义
可编辑 作为回调函数。请参阅wiki 文章。它允许使某些行中的列可编辑,而其他行中的列不可编辑。
Because you use the example from my old answers (this and this) I feel that I should answer also on your question.
In the old example all fields, which can be modified during Add or Edit dialogs, has property
editable:true
. The fields which should be shown only in the Add dialog will be made hidden inside of beforeShowForm event handle. In the same way we can temporary switch some fields toeditable:false
before call of the editRow method and reset back to theeditable:true
immediately after the call:You can see this live here.
UPDATE: Free jqGrid allows to define
editable
as callback function. See the wiki article. It allows to make the column editable in some rows and holding non-editable for other rows.