zoukankan      html  css  js  c++  java
  • Ext 4.2 RowEditing




    Follow: function () { Ext.define('Follow', { extend: 'Ext.data.Model', idProperty: 'id', fields: [ { name: 'id', type: 'int' }, { name: 'name', type: 'string' }, { name: 'Explain', type: 'string' }, { name: 'Sequence', type: 'int' } ] }); var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToEdit: 1, //单击 clicksToMoveEditor: 1, //单击移动修改栏 autoCancel: false, saveBtnText: '保存', cancelBtnText: '取消' }); var store = Ext.create('Ext.data.Store', { autoDestroy: true, model: 'Follow', proxy: { type: 'ajax', url: '/data/Settings/CustomerSettingHandler.ashx?action=follow', reader: { type: 'json', root: 'rows', } }, listeners: { update: function (store, record) { var jsondate = record.get("id") + "|" + record.get("name") + "|" + record.get("Explain") + "|" + record.get("Sequence"); $.post('/data/Settings/CustomerSettingHandler.ashx', { action: 'followSubmit', json: jsondate }, function (data) { if (data !== "ok") { Ext.Msg.alert("提示", '操作失败!'); store.load(); } }); }, remove: function (store, record) { var id = record.get("id"); if (id == 0) { return; } $.post('/data/Settings/CustomerSettingHandler.ashx', { action: 'followDelete', json: id }, function (data) { if (data !== "ok") { Ext.Msg.alert("提示", '操作失败!'); store.load(); } }); } }, autoLoad: true }); var grid = Ext.create('Ext.grid.Panel', { title: "跟进方式", floatable: false, border: false, store: store, columns: [ new Ext.grid.RowNumberer({ text: "序号", 50 }), { header: '跟进方式', dataIndex: 'name', flex: 2, editor: { allowBlank: false } }, { header: '说明', dataIndex: 'Explain', flex: 2, editor: { } }, { header: '排序', dataIndex: 'Sequence', flex: 1, editor: { xtype: 'numberfield', allowBlank: false, minValue: 1, maxValue: 150000 } }, { header: '删除', xtype: 'actioncolumn', flex: 1, sortable: false, menuDisabled: true, items: [{ icon: '/images/delete.gif', tooltip: '删除', handler: function (grid, rowIndex) { var sm = grid.getSelectionModel(); grid.getStore().removeAt(rowIndex); if (grid.getStore().getCount() > 0) { sm.select(0); } } }] }], plugins: [rowEditing], selModel: { selType: 'cellmodel' }, tbar: [{ text: '增加', handler: function () { rowEditing.cancelEdit(); var rec = Ext.create("Follow", { Id: 0, name: '跟进方式', Explain: '说明', Sequence: 1 }); grid.getStore().insert(0, rec); rowEditing.startEdit(0, 0); } }] }); return grid; },
  • 相关阅读:
    tfidf 问题
    Win32汇编窗口程序设计[03]第一个窗口程序
    Win32汇编窗口程序设计[01]开发环境的搭建
    Win32汇编窗口程序设计[02]RadASM简介
    寄存器引用结构体变量
    始终居中的弹出层
    JSonJavaScript
    json
    <收录>jqueryuidatapicker生成的页面html
    网站数据抓取
  • 原文地址:https://www.cnblogs.com/Celebrator/p/4584036.html
Copyright © 2011-2022 走看看