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
- PHP与MySQL开发中的字符编码问题
- ES6中Generator理解
- T-SQL动态查询(3)——静态SQL
- T-SQL动态查询(3)——静态SQL
- 程序Hello World解析
- ABAP 复制标准的GUI STATUS
- Google Android SDK 开发范例大全 第二章 阅读小笔记
- IE的layout属性详解
- python3.X安装matplotlib简单方法
- 开源库ZXing加入xcode工程报错几个原因及解决方法
- poj 1302 Blue Gene, Jr. 递归
- Linux线程简说
- 后台控件常用的一些属性
- 【bzoj 1251】序列终结者
- freeswitch会议模块lua脚本
- Leetcode172: Minimum Size Subarray Sum
- Java 与无符号那些事儿
- struts2 流程分析
- makefile
- OpenGL ES雾