Results 1 to 2 of 2

Thread: Render fail in process to restore grid state

  1. #1

    Default Render fail in process to restore grid state

    Hi,

    I have one griview whit some columns, then in the forum I found some code to save and restore the state of the columns int one database. I'am successful return the information about It in the database and send to the grid. But when I iterate in the cm.Config and set the values for each config and call the cm.setConfig(newConfig), the columns is not rendered correctly. see in the picture attached.

    Code:
    var or = Ext.decode(response.responseText); // the state return in the db
    if (or.Success) {    
        var cm = grid.getColumnModel();                        
        var newConfig = cm.config;
        ds = grid.getStore()
        
        for (var i = 0; i < or.Result[0].Data.length; i++) {                    
            if(newConfig[i].dataIndex) 
                newConfig[i].dataIndex = or.Result[0].Data[i].dataIndex;
            if(newConfig[i].hidden)
                newConfig[i].hidden = or.Result[0].Data[i].hidden;
            if(newConfig[i].width)
                newConfig[i].width = or.Result[0].Data[i].width;
            if(newConfig[i].direction){
                sort = {
                        direction : or.Result[0].Data[i].direction,
                        dataIndex : or.Result[0].Data[i].dataIndex
                    };
            }                                
            if (sort) {
                ds.sort(sort.dataIndex, sort.direction);
            }
        }
        cm.setConfig(newConfig); At this point, the columns are not rendered correctly.
    }
    Well, where I'am write someone wrong? It is missing some configuration? Below in the left picture the correctly columns rendered whit default grid columns config, and in the right picture, the worng columns after the call to cm.setConfig(newConfig) to set the stored state columns config.
    Attached Images Attached Images

  2. #2

    Default

    anyone?

Posting Permissions

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