1. 程式人生 > >Extjs知識點匯總

Extjs知識點匯總

cor 數據改變 tor cti result his col d+ ext

自定義渲染單元格內容

{
            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; }); });

Extjs知識點匯總