zoukankan      html  css  js  c++  java
  • sencha gridpanel 单元格编辑

    {
    xtype: 'gridpanel',
    region: 'north',
    height: 150,
    title: 'My Grid Panel',
    store: 'A_Test_Store',
    columns: [
    {
    xtype: 'gridcolumn',
    dataIndex: 'Name',
    text: 'Name',
    editor: {
    xtype: 'textfield'
    }
    },
    {
    xtype: 'gridcolumn',
    dataIndex: 'Content',
    text: 'Content'
    },
    {
    xtype: 'gridcolumn',
    dataIndex: 'Time',
    text: 'Time'
    }
    ],
    plugins: [
    Ext.create('Ext.grid.plugin.CellEditing', {
    clicksToEdit: 1,  //点击单元格编辑
    listeners: {
    beforeedit: {
    fn: me.onCellEditingBeforeEdit,
    scope: me
    },
    validateedit: {
    fn: me.onCellEditingValidateedit,
    scope: me
    }
    }
    })
    ]
    }

    onCellEditingBeforeEdit: function(editor, e, eOpts) {//动态赋值用.正常情况下不需要该事件.

          e.record.data[e.field]= "my test";

    e.value="my test";
    e.record.commit(); //提交,不提交无效

    }

    onCellEditingValidateedit: function(editor, e, eOpts) {

    if(e.row==1) //验证逻辑
    {
    e.cancel=true; //取消
    e.record.data[e.field] = e.value;
    }

    e.record.commit();

    }

    原文地址:http://www.cnblogs.com/xuejianxiyang/p/4998035.html

  • 相关阅读:
    关于Manjaro+kde桌面Tim闪退的解决
    Manjaro-kde-18.1.3安装体验
    Ubuntu19.10安装
    OPPO R11刷机初体验
    Microsoft store应用商店打不开0x80131500
    提问回顾与个人总结
    OO第三单元总结
    OO第二单元总结
    软工案例分析作业
    OO第一单元总结
  • 原文地址:https://www.cnblogs.com/xuejianxiyang/p/4998035.html
Copyright © 2011-2022 走看看