将版本限制为行编辑器网格中的一个单元格

发布于 2024-09-19 17:05:44 字数 301 浏览 2 评论 0原文

在我的 editorGrid 中,我有一列带有 dateField 编辑器,当网格被渲染时,我将该字段设置为不可编辑:

myColModel.setEditable(colIdex,false)

在同一行中其他单元格中的值更改后,它将是可编辑的,

myColModel.setEditable(colIdex,true)

问题是:该列中的所有单元格都是editables

我怎样才能只使所选行中的单元格可编辑

,非常感谢

in my editorGrid i have one column with dateField editor , when the grid is rendred i set that field to non editable :

myColModel.setEditable(colIdex,false)

it will be editable after the value changed in other cell in the same row

myColModel.setEditable(colIdex,true)

the probleme is : all the cells in the column are editables

how can i do to make only the cell in the selected row editable

and many thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

治碍 2024-09-26 17:05:44

使用 EditorGrid 上的“beforeedit”侦听器 - 您可以检查他们尝试编辑的字段。如果未设置其他字段,则返回 false 以不允许他们编辑该字段。

Use the 'beforeedit' listener on the EditorGrid - you can inspect the field they are trying to edit. If the other field isn't set, return false to not allow them to edit that field.

通知家属抬走 2024-09-26 17:05:44

基本上,您可以创建条件逻辑并隐藏基于行模型的编辑按钮。

dataBound: function (){
       var grid = this;
       var trs = this.tbody.find('tr').each(function(){
         var item = grid.dataItem($(this));
         if( item.UnitPrice % 5 == 0) {
           $(this).find('.k-grid-edit,.k-grid-delete').hide();
         }
       });               
     },

Basically you can create conditional logic and hide the edit buttons based on the row model.

dataBound: function (){
       var grid = this;
       var trs = this.tbody.find('tr').each(function(){
         var item = grid.dataItem($(this));
         if( item.UnitPrice % 5 == 0) {
           $(this).find('.k-grid-edit,.k-grid-delete').hide();
         }
       });               
     },
ヅ她的身影、若隐若现 2024-09-26 17:05:44

您可以通过重写 isCellEditable 函数来以其他方式完成此操作。
检查下面的链接。

http://www.sencha.com/learn/Ext_FAQ_Grid#Disable_editing_of_pspecial_rows.2C_columns.2C_etc

You can do it other way by just overriding the isCellEditable function.
Check the below link.

http://www.sencha.com/learn/Ext_FAQ_Grid#Disable_editing_of_particular_rows.2C_columns.2C_etc

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文