Search code examples
extjsgridextjs4extjs4.1extjs4.2

EXTJS4: Compare two fields in GridPanel with each other


I have a Grid-Panel with a few columns. Now I want to set a new Class in a Column of a Row, when the values don't match with each other. But how can i get success to a column in a different row? Her is my code which I tried, but it says, the ID is undefined:

...{
    header: 'CRS',  
    dataIndex: 'crs',
    id:'crs',
    flex:1,
    renderer: function(value, meta) {

        console.log("csv-->"+Ext.getCmp('csv').value);

        if(value==Ext.getCmp('csv').value)
            {
                //change class
            }

    }
},
{
    header: 'CSV', 
    dataIndex: 'csv',
    id:'csv',
    flex:1
},...

Solution

  • I have it! This works for me:

    {
        header: 'CSV', 
        dataIndex: 'csv',
        flex:1,
        renderer: function(grid, rowIndex, rowdata) {
            var csv_data=rowdata.data.csv;
            var crs_data=rowdata.data.crs;
            if (csv_data != crs_data) { 
               rowIndex.tdCls = "red-class";
            } 
                return csv_data;
    
        }
    },