Threaded View

  1. #1
    Sencha User
    Join Date
    Apr 2009
    Posts
    1
    Vote Rating
    0
    frugardc is on a distinguished road

      0  

    Default Unanswered: How to Change the getRowClass function on an ExtJS GridPanel viewconfig After Render

    Unanswered: How to Change the getRowClass function on an ExtJS GridPanel viewconfig After Render


    I have an Ext.grid.Panel with a function that returns a custom class that is used to color code rows in the grid by overriding the getRowClass function. This works great, but I would like to give the user the option to change the criteria by which the grid is colored. The below example, I am coloring by the "severity" attribute, but I would like to change that to "status", for example. Is there a way I can dynamically change the getRowClass function,or maybe the entire viewconfig on the grid, and have the grid recolor, after the grid has already been rendered?
    </span>
    Code:
        alarmsGrid = Ext.create('Ext.grid.Panel', 
    {    title: 'Netcool Alarms', 
       id: 'Netcool Alarms', 
       columnLines: true, 
       store: alarms_store,
        loadMask: true, 
       stripeRows: true, 
    viewConfig: { 
             getRowClass: function(record, rowIndex, rowParams, store){ 
                       return record.get('severity').toLowerCase(); 
           } 
       },
    Note:
    Code:
    alarmsGrid.viewConfig.getRowClass = function(record, rowIndex, rowParams, store){ return record.get('status').toLowerCase(); }
    seems to have no effect
    Last edited by frugardc; 28 Dec 2012 at 11:34 AM. Reason: Formatting messed up