Results 1 to 2 of 2

Thread: [SOLVED] Updating grid after store change

  1. #1
    Sencha User
    Join Date
    Sep 2007
    Posts
    73

    Default [SOLVED] Updating grid after store change

    Hi,

    I create a DataStore like so (code snippet only):
    PHP Code:
    ds = new Ext.data.Store({
                
    proxy:  new Ext.data.HttpProxy({
                
    urlApp.baseUrl +'index.php/videos/grid/'+nid,
                
    disableCaching:false
            
    }),
            
    reader:  new Ext.data.JsonReader(
    ....
    ....
    .... 
    Notice I am passing nid which is an id number. This is so I can return only the items with that id from the table.

    Then I create a grid, and pass ds to it, like so (code snippet only):
    PHP Code:
    grid = new Ext.grid.EditorGrid(
        
    'videogrid-editor',
        {
            
    dsds,
            
    cmgetColumnModel(),
            
    autoSizeColumnsfalse,
            
    selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
            
    enableColLockfalse
        
    }
    ); 
    Now this works great. But, I need to use the same grid for other items. So, I need to create the same ds but passing a different nid. Hence a different store. I want to display the new data on the grid presented by this ds.

    I tried creating a new ds by passing a new nid. Then I did:
    PHP Code:
    ds.reload();
    grid.getView().refresh(); 
    But the grid does not present the new data from the new ds supplied. I do not want to re-create the grid everytime I need a new ds with a new nid, basically I dont want to say this everytime ->
    PHP Code:
    grid = new Ext.grid.EditorGrid
    I just want to use the same grid instance, but change the ds and display new data in it.

    Thanks

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    73

    Default

    Found it

    PHP Code:
    grid.reconfigure(dscolumnModel);
    ds.reload(); 
    That did it.

Posting Permissions

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