自定义渲染单元格内容
{ name:"device.flag", header: ‘确认‘, dataIndex: ‘flag‘, width:50, renderer: function(value, cellmeta, record, rowIndex, columnIndex, store){ if(value == ‘1‘){ return "<input id=‘flag12‘ name=‘flag‘ type=‘checkbox‘ onclick=‘javascript:changeme(this,"+rowIndex+","+columnIndex+")‘ checked=true>"; } return "<input id=‘flag1‘ name=‘flag‘ onclick=‘javascript:changeme(this,"+rowIndex+","+columnIndex+")‘ type=‘checkbox‘ >"; } }
获取单元格内容的值
function changeme(obj,rowIndex, columnIndex){ console.log(rowIndex+"changeme1:"+obj.checked+columnIndex); var store = Ext.getCmp("grid_ly").getStore(); var record = store.getAt(rowIndex); console.log(rowIndex+"record:"+record.data.flag); if(obj.checked){ record.data.flag="1"; }else{ record.data.flag="0"; } }
遍历表格数据改变行背景色
resultGrid.getStore().on(‘load‘,function(s,records){ var girdcount=0; s.each(function(r){ if(r.get(‘QRQK‘)==‘待确认‘){ resultGrid.getView().getRow(girdcount).style.backgroundColor=‘#FFE4E1‘; }else{ resultGrid.getView().getRow(girdcount).style.backgroundColor=‘#C1FFC1‘; } girdcount=girdcount+1; }); });
时间: 2024-10-23 19:20:22