Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 jqGrid 中更新/编辑工作我必须使主键列可编辑。
但它们应该只能在添加新记录时才可编辑,而不是在更新旧记录时。
有没有办法解决这个问题?我想这一定是非常普遍的问题,但我没有找到任何解决方案。
提前感谢您帮助我。
我希望我的另一个答案(有两个旧答案的链接)可以解决您的问题。
如果您使用服务器基本数据类型(“json”和“xml”),服务器将始终生成 id,您不必使 id 列可编辑。
如果您遵循内联编辑onCellSelect原则,您可以在输入方法或时指明要编辑的列onSelectRow。
onCellSelect
onSelectRow
为此,您只需将可编辑的属性更改为所需的值:
$(this).getColProp('ColumnName').editable = false || true;