设置Ext.grid.PropertyGrid中value值 编辑属性为只读

抛砖啊抛砖。。。

项目需要,使用到PropertyGrid,必然的,某些属性项目期望在使用过程中不能被修改

内事不决问摆渡。。。

查到论坛的一篇帖子《[EXT] Ext.grid.PropertyGrid组件有什么办法可以设置成只读的吗?

论坛地址:www.iteye.com/topic/148460

 taelons的解决方法是: 在beforeedit事件处理中设置e.cancel = true

我笨,试了下,没取得想要的效果,,,

构造PropertyGrid时,用得正好是 taelons 达人的方法

taelons 的博客:blog.csdn.net/xujiaqiang/

PropertyGrid代码示例:blog.csdn.net/xujiaqiang/archive/2007/07/09/1683768.aspx

所以考虑是不是也构造一个新的customEditors,只能显示,不能修改,

思路如下(以下皆指源码):

PropertyGrid 中,editors 的定义里,“string” 是一个Ext.form.TextField,仿照着这个定义一个新的editor,估计着应该有disabled类似的属性,

于是有了这样的代码:

js 代码
  1. propsGrid.customEditors = {           
  2.     "对象名" : new Ed(new Ext.form.TextField({      
  3.         disabled:true,      
  4.         disabledClass:""          
  5.     }))      
  6. };      

 

 

你可能感兴趣的:(.net,ext,Blog)