如何在 JQGrid 的行编辑中禁用某些单元格的编辑? [英] How to disable editing for some cells in row editing of JQGrid?

查看:19
本文介绍了如何在 JQGrid 的行编辑中禁用某些单元格的编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击网格的任何一行时,所有可编辑的列都变为可编辑的.

When I click on any row of my Grid, All editable columns become editable.

我希望某些列可以在每一行上分别进行编辑.

I want some of the columns to be editable on each row separately.

                 Column 1,   Column 2,     Column 3             
ROW Number 1 - editable,     non-editable, non-editable  
ROW Number 2 - non-editable, editable,     non-editable    
ROW Number 3 - editable,     non-editable, non-editable  

提前致谢

推荐答案

如果你使用 内联编辑模式 并且想要动态地决定该行的哪些单元格可以编辑,例如基于单元格的包含,您可以通过以下方式执行此操作我描述了 这里.你也可以用另一种方法来做到这一点:

If you use inline editing mode and want to decide dynamically which cells of the row will be editable for example based on the contain of the cells you can do this in the way which I described here. You can do this with another method also:

$(this).jqGrid('setColProp', 'YouColumnName', {editable:false});

所以你应该把 editable 设置为 falsetrue before 调用 editRow 方法.这样你就可以实现任何你想要的逻辑.

So you should just set editable to false or true before calling of editRow method. In the way you can implement any logic which you want.

更新: Free jqGrid 允许定义 可编辑 作为回调函数.请参阅维基文章.它允许在某些行中使列可编辑,而对其他行保持不可编辑.

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.

这篇关于如何在 JQGrid 的行编辑中禁用某些单元格的编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆