小女子请问一个 Ext.ux.grid.RowEditor的问题
itsmTicketWp.cmlist = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header : '任务', dataIndex : 'task', width : 200, editor : new Ext.form.TextField({ allowBlank : false })}, { header : '描述', dataIndex : 'taskDesc', width : 200, editor : new Ext.form.TextField({})}, { header : '位置', dataIndex : 'attribute', width : 200, editor : new Ext.form.TextField({})}, { header : '巡检值', dataIndex : 'resultDesc', width : 200, editor : new Ext.form.TextField({})}, { header : '结论', dataIndex : 'endReview', width : 200, editor : { xtype : 'sysSelect', options : [ [ '0', '不正常' ], [ '1', '正常' ] ] }, renderer : function(v, m, r) { var x = r.get('endReview'); return (x == '0' ? '不正常' : '正常'); }}, { header : '说明', dataIndex : 'resultExplain', width : 200, editor : new Ext.form.TextField({})} ]);itsmTicketWp.storelist = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ url : appName + itsmTicketWp.action + '?act=getWorkPollingJson' }), reader : new Ext.data.JsonReader({ root : 'datalist' }, itsmTicketWp.ItsmWpollingItemTemp), pruneModifiedRecords : true});itsmTicketWp.editor = new Ext.ux.grid.RowEditor({ saveText : '保存', cancelText : '取消', commitChangesText : '请先保存或取消', errorText : '提示'});// 巡检项行编辑保存和取消事件itsmTicketWp.editor.on({ afteredit : function(roweditor, changes, record, rowIndex) {alert(11); Ext.Ajax.request({ url : appName + itsmTicketWp.action + '?act=saveOrUpdateWorkPolling', params : { itsmWorkPolling : Ext.encode(record.data) }, success : function() { itsmTicketWp.gridList.store.commitChanges(); //itsmTicketWp.gridList.store.reload(); Ext.getCmp(itsmTicketWp.idHead + 'itemAdd').enable(); } }); }, canceledit : function(roweditor, changes, record, rowIndex) { var r = itsmTicketWp.gridList.getSelectionModel().getSelected(); if (r.get('id') == null || r.get('id') == "") itsmTicketWp.gridList.store.remove(r); else itsmTicketWp.gridList.store.rejectChanges(); Ext.getCmp(itsmTicketWp.idHead + 'itemAdd').enable(); }});// 巡检项GriditsmTicketWp.gridList = new Ext.grid.EditorGridPanel({ region : 'center', loadMask : true, autowidth : true, height : 300, viewConfig : { forceFit : true }, store : itsmTicketWp.storelist, // storecheck, cm : itsmTicketWp.cmlist, sm : new Ext.grid.RowSelectionModel({ singleSelect : false }), plugins : [ itsmTicketWp.editor ], tbar : [ '->', { id : itsmTicketWp.idHead + 'itemAdd', text : '增加', handler : onItemAdd, iconCls : 'page_add', disabled : false }, '-', { id : itsmTicketWp.idHead + 'itemDelete', text : '删除', handler : onItemDelete, iconCls : 'page_delete', disabled : true } ]});
如果是其他原因引起的,我就不太知道了.
另外监听canceledit时,如果你新增而且直接保存,会发生什么情况呢?
[解决办法]
好像有個屬性值 可以判斷是update 還是add 還是delete 的