lobby88 2010-04-19 01:14
浏览 284
已采纳

头痛的EXT girdEditor问题

var cm = new Ext.grid.ColumnModel([{
           id:'common',
           header: "Common Name",
           dataIndex: 'common',
           width: 220,
           editor: new fm.TextField({
               allowBlank: false,
                listeners:{  
                 //我想在这里添加一个事件,让这个TextField显示的时候根据显示值来决定这个TextField是否可以
                 //编辑,也就是说Grid的每列的每个cell因为值不同而决定是否可编辑。帮忙看看!
                } 
    })
        },{
           header: "Light",
           dataIndex: 'light',
           width: 130,
           editor: new Ext.form.ComboBox({
               typeAhead: true,
               triggerAction: 'all',
               transform:'light',
               lazyRender:true,
               listClass: 'x-combo-list-small'
            })
        },{
           header: "Price",
           dataIndex: 'price',
           width: 70,
           align: 'right',
           renderer: 'usMoney',
           editor: new fm.NumberField({
               allowBlank: false,
               allowNegative: false,
               maxValue: 100000
           })
        },{
           header: "Available",
           dataIndex: 'availDate',
           width: 95,
           renderer: formatDate,
           editor: new fm.DateField({
                format: 'm/d/y',
                minValue: '01/01/06',
                disabledDays: [0, 6],
                disabledDaysText: 'Plants are not available on the weekends'
            })
        }
    ]);



问题:
      {
           id:'common',
           header: "Common Name",
           dataIndex: 'common',
           width: 220,
           editor: new fm.TextField({
               allowBlank: false,
                listeners:{
               
                 //我想在这里添加一个事件,让这个TextField显示的时候根据显示值来决定这个TextField是否可以
                 //编辑,也就是说Grid的每列的每个cell因为值不同而决定是否可编辑。帮忙看看!
                
                } 
    })
        }

 

  • 写回答

11条回答 默认 最新

  • upup1000 2010-04-19 16:09
    关注

    [code="java"]var store = new Ext.data.SimpleStore({
    data : [['lcs' , 28 , 'dpc'],['mlx' , 27 , 'hfzg']],
    fields : ["name" , "age" , "unit"]
    });
    isCellEditable = function(c,r){
    var record = store.getAt(r);
    if(c!=1)return true;
    return record.get("age") >= 28;
    };
    var cm = new Ext.grid.ColumnModel({
    columns : [{
    header : "姓名",
    dataIndex : "name",
    editor : new Ext.form.TextField()

        },{
            header : "年龄",
            dataIndex : "age",
            editor : new Ext.form.TextField(),
            renderer : function(value, metadata , record , r , c , store){
                return isCellEditable(c,r)?value:String.format('<div style="width:100%;background:#ccc;">{0}</div>',value);
            }
        },{
            header : "单位",
            dataIndex : "unit",
            editor : new Ext.form.TextField()
        }],
        isCellEditable : isCellEditable
    });
    
    var grid = new Ext.grid.EditorGridPanel({
        renderTo : Ext.getBody(),
        width : 300,
        height : 260,
        cm : cm,
        store : store,
        title : "Info"
    });[/code]
    

    作个参考吧

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(10条)

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值