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: "序号", width: 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; },