extjs中的表格编辑
2016-01-16 17:30
766 查看
要实现ext表格编辑首先需要启用CellEditing插件,示例代码如下:
调用了CellEditing插件之后需要为需要编辑的列指定编辑器
编辑之后的数据需要保存,调用grid.on('edit', function (editor, e) {});即可
grid = Ext.create('Ext.grid.Panel', { renderTo : 'information_date',// 渲染到一个div上 frame : true,// 面板渲染 forceFit : true,// 自动填充panel空白处 autoHeight:true, plugins:[ Ext.create('Ext.grid.plugin.CellEditing',{ // clicksToEdit:1 //设置单击单元格编辑 }) ] }
调用了CellEditing插件之后需要为需要编辑的列指定编辑器
columns: [ { xtype: "rownumberer", text: "序号", width:40 }, { text: '姓名', dataIndex: 'name' }, { text: '年龄', dataIndex: 'age', xtype: 'numbercolumn', format: '0', editor: { xtype: "numberfield", decimalPrecision: 0, selectOnFocus: true } }, { text: '电话', dataIndex: 'phone', editor: "textfield" }
编辑之后的数据需要保存,调用grid.on('edit', function (editor, e) {});即可
grid.on('edit', function (editor, e) { Ext.Msg.confirm('系统提示','确定修改?',function(btn){ if(btn=='yes'){ Ext.Ajax.request({ url: path+'/SuppliesMaintainController/xxxx.do', method: 'post', params:{}, success: function(response,opts){ // var respText = Ext.decode(response.responseText); // Ext.Msg.alert('提示',respText.success); } }); } }); // e.record.commit(); });
相关文章推荐
- js中将字符串转换成数字
- JavaScript 输出
- ExtJS请求验证方法
- js中验证是否是数字
- 外部的 JavaScript
- JSON数据解析
- <body> 中的 JavaScript 函数
- JS页面跳转和js对iframe进行页面跳转、刷新
- <head> 中的 JavaScript 函数
- <body> 中的 JavaScript
- HTA全解析:给VBS和JS一个强大的交互界面
- jsp页面格式化数字或时间
- JavaScript 用法
- JSON的三种解析方式
- JavaScript:验证输入
- JS魔法堂:彻底理解0.1 + 0.2 === 0.30000000000000004的背后
- JavaScript: 2015 年回顾与展望
- JavaScript:改变 HTML 样式
- JavaScript:改变 HTML 内容
- 在javascript中,哪些值能作为if的条件