GridPanel的listeners(监听事件)
EditorGridPanel编辑事件以及赋值
var gridArray = new Ext.grid.EditorGridPanel({ title:'', height: 350, id:'gridArray', name:'gridArray', sm:sm, colModel: col, clicksToEdit: 1, store: store, autoScroll: true, viewConfig: { forceFit: true, columnsText: '显示的列', scrollOffset: 20, sortAscText: '升序', sortDescText: '降序' } }); gridArray.on('afteredit', function(e, cell) { var row = e.row; //完税金额 var WSJE=parseFloat(gridArray.getStore().getAt(row).data.RATEMONEY); //关税率 var GSL=parseFloat(gridArray.getStore().getAt(row).data.GUANRATE)/100; //关税额 var GSE=parseFloat(WSJE*GSL); gridArray.getStore().getAt(row).set("GUANMONEY",parseFloat(GSE).toFixed(2)); //VAT完税金额 var VATWSJE=parseFloat(WSJE)+parseFloat(GSE); gridArray.getStore().getAt(row).set("VATRATEMONEY",parseFloat(VATWSJE).toFixed(2)); //增值税率 var ZZSL=parseFloat(gridArray.getStore().getAt(row).data.VAT); //增值税金额 gridArray.getStore().getAt(row).set("VATMONEY",parseFloat(VATWSJE*ZZSL).toFixed(2)); store.commitChanges(); });
这里的"cellmousedown"可以换成其他事件
var gridArray = new Ext.grid.GridPanel({ cm: colMReport, autoScroll: true, store: storeReportList, id: "gridArray", listeners: { 'cellmousedown': function(gridArray, rowIndex, e) //单击击事件 { if (e == 14) { var INITIALNAME = gridArray.getStore().getAt(rowIndex).data.INITIALNAME; //销售员 var NAMECN = gridArray.getStore().getAt(rowIndex).data.NAMECN; //销售员名称 } } }, loadMask: true, viewConfig: { columnsText: '显示的列', scrollOffset: 20, sortAscText: '升序', sortDescText: '降序' } });