Extjs设置GridPanel选中行背景色和选中单元格背景色
var view = grid.getView();
view.getRow(index).style.backgroundColor = "red"; //选中行背景色
view.getCell(rowIndex,colIndex).style.backgroundColor = "red"; //选中单元格背景色
我在开发时是在CheckboxSelectionModel中的beforerowselect中进行设置的:
var smQd = new Ext.grid.CheckboxSelectionModel({ 'beforerowselect':function(sm,rowIndex,keepExisting,record){ var l = storeXtcpyy.getCount(); for(var i=0;i
gridXtcpyy.addListener('cellclick', function (grid, rowIndex, columnIndex, event) { var view = gridXtcpyy.getView(); view.getRow(rowIndex).style.backgroundColor = "#DFE8F6"; }, gridXtcpyy);
var smQd = new Ext.grid.CheckboxSelectionModel({ renderer:function(value, metaData, record, rowIndex, colIndex, store){ if((org_id == record.data['dsfjg'])||(top_org_id == org_id)){ if((record.data['ywdm']=="901")||(record.data['xgdjzt'].split("-")[0] == 2)||(record.data['khlxzt'].split("-")[0] != 0)||(record.data['khtzzt'].split("-")[0] != 0)){ return ""; }else{ return ''; } }else{ return ""; } }, //不允许使用点击表格形式修改选择 //handleMouseDown:Ext.emptyFn, listeners:{ /*'rowselect':function(sm,rowIndex,record){ var view = gridXtcpyy.getView(); view.getRow(rowIndex).style.backgroundColor = "#DFE8F6"; }, 'rowdeselect':function(sm,rowIndex,record){ var l = storeXtcpyy.getCount(); for(var i=0;i0){ var select_zyed = 0; var yxt_rs = 0; for(var i=0;i =gmqdje && parseFloat(jyje_sel) < xzje){ yxt_rs ++; } } } used_ed.setValue(rendererZhMoney(select_zyed)); //var total_ed_arr = total_ed.getValue().split(","); var total_ed_arr = Ext.getCmp("total_ed").getValue().split(","); var _total_ed = ""; for(var j = 0; j< total_ed_arr.length; j++){ _total_ed += total_ed_arr[j]; } _total_ed = parseFloat(_total_ed); var sure_used_ed_arr = Ext.getCmp("sure_used_ed").getValue().split(","); var _sure_used_ed = ""; for(var j = 0; j< sure_used_ed_arr.length; j++){ _sure_used_ed += sure_used_ed_arr[j]; } _sure_used_ed = parseFloat(_sure_used_ed); var yfdx_wqr_ed_arr = Ext.getCmp("yfdx_wqr_ed").getValue().split(","); var _yfdx_wqr_ed = ""; for(var j = 0; j< yfdx_wqr_ed_arr.length; j++){ _yfdx_wqr_ed += yfdx_wqr_ed_arr[j]; } _yfdx_wqr_ed = parseFloat(_yfdx_wqr_ed); //console.log("---------:"+Subtr(_total_ed,accAdd(accAdd(_sure_used_ed,_yfdx_wqr_ed),select_zyed))); //leave_ed.setValue(rendererZhMoney(_total_ed-_sure_used_ed-_yfdx_wqr_ed-select_zyed)); leave_ed.setValue(rendererZhMoney(Subtr(_total_ed,accAdd(accAdd(_sure_used_ed,_yfdx_wqr_ed),select_zyed)))); //leave_ed.setValue(rendererZhMoney(Subtr(total_ed,select_zyed))); total_rs = total_xje_rs.getValue(); ytz_rs = ytz_xje_rs.getValue(); yxz_xje_rs.setValue(yxt_rs); sy_xje_rs.setValue(Subtr(total_rs,accAdd(ytz_rs,yxt_rs))); }else{ used_ed.setValue(rendererZhMoney(0)); //leave_ed.setValue(total_ed.getValue()); var total_ed_arr = Ext.getCmp("total_ed").getValue().split(","); var _total_ed = ""; for(var j = 0; j< total_ed_arr.length; j++){ _total_ed += total_ed_arr[j]; } _total_ed = parseFloat(_total_ed); var sure_used_ed_arr = Ext.getCmp("sure_used_ed").getValue().split(","); var _sure_used_ed = ""; for(var j = 0; j< sure_used_ed_arr.length; j++){ _sure_used_ed += sure_used_ed_arr[j]; } _sure_used_ed = parseFloat(_sure_used_ed); var yfdx_wqr_ed_arr = Ext.getCmp("yfdx_wqr_ed").getValue().split(","); var _yfdx_wqr_ed = ""; for(var j = 0; j< yfdx_wqr_ed_arr.length; j++){ _yfdx_wqr_ed += yfdx_wqr_ed_arr[j]; } _yfdx_wqr_ed = parseFloat(_yfdx_wqr_ed); //leave_ed.setValue(rendererZhMoney(_total_ed-_sure_used_ed-_yfdx_wqr_ed)); leave_ed.setValue(rendererZhMoney(Subtr(_total_ed,accAdd(_sure_used_ed,_yfdx_wqr_ed)))); total_rs = total_xje_rs.getValue(); ytz_rs = ytz_xje_rs.getValue(); yxz_xje_rs.setValue(0); sy_xje_rs.setValue(Subtr(total_rs,ytz_rs)); } }, 'beforerowselect':function(sm,rowIndex,keepExisting,record){ var l = storeXtcpyy.getCount(); for(var i=0;i