Results 1 to 4 of 4

Thread: EditorGridPanel, custom renderer and repaint

  1. #1

    Question EditorGridPanel, custom renderer and repaint

    Hi

    I am using a EditorGridPanel with a custom render function.
    When values are below a threshold, the color of the cell changes

    But when the threshold changes, all cells needs to be repainted.
    I can't get this working.

    Things i have ried:
    grid.render(), no joy.
    Reloading the store: grid.getStore().reload() gives an error. (this.proxy is undefined)

    Code:
     for (var d = 2; d < histColumns.length; d++) {
            gridColumns.push(new Ext.grid.Column({
                header: histColumns[d].header,
                summaryType: histColumns[d].summaryType !== undefined ? histColumns[d].summaryType : historyData.summaryType,
                align: 'right',
                width: 30,
                sortable: true,
                renderer: gridRendererColor,  
                dataIndex: histColumns[d].dataIndex
            }));
        }
    
        function gridRendererColor(val, x, y, row, column, oo){
            if (isNaN(val)) {
                return '-';
            }
            else {
                if (y.json === undefined) { // total column.. skip
                    return val;
                }
                var color = cellBackground;
                try {
                    var cell = historyData.historyTable.getCell(y.json.dataPtr, column - 1);
                    color = cell.color;
                } 
                catch (err) {
                
                }
                userLog.addLine("Color : " + color);
                return '<span style="color:#' + colorBlack + ';background:#' + color + ';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + val + '</span>';
            }
        }
        
    
    var reader = new Ext.data.JsonReader({
    fields..... not relevant
    });
    
     var summary = new Ext.ux.grid.GroupSummary();
    
     var grid = new Ext.grid.EditorGridPanel({
            ds: new Ext.data.GroupingStore({
                reader: reader,
                // use local data
                data: data2,
                sortInfo: {
                    field: 'groupText',
                    direction: 'ASC'
                },
                groupField: 'groupText'
            }),
            columns: gridColumns,
            
            view: new Ext.grid.GroupingView({
                forceFit: true,
                showGroupName: false,
                enableNoGroups: false,
                enableGroupingMenu: false,
                hideGroupedColumn: true
            }),
            plugins: [summary],
            border: false,
            animCollapse: false,
            trackMouseOver: false,
            items: []
        });
    Thx

  2. #2

    Thumbs up Fixed

    Well at least it's working for me.

    Code:
                        var store = grid.getStore();
                        for (var j = 0; j < numberOfRecs; j++) {
                            store.fireEvent("update", store, store.getAt(j), Ext.data.Record.COMMIT);
                        }

  3. #3
    Sencha User VinylFox's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,501

    Default

    The more standard way would be...

    Code:
    grid.getView().refresh()
    All the visuals that happen in a Grid are controlled by the View (GridView)

  4. #4

    Default

    Thanks, that's better

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •