1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    2
    Vote Rating
    0
    codydjango is on a distinguished road

      0  

    Default updating fields and columns on a datagrid and store

    updating fields and columns on a datagrid and store


    hello! first post.

    I'm attempting a datagrid that updates dynamically. User picks some configuration, a request is sent to the server, the response contains the headers and data, and a new grid is displayed with said headers and data.

    This is what I've attempted:

    1) user chooses new query --> set new baseparams on the store
    2) update store fields --> store.reader.meta.fields = NewFields();
    3) create new columns --> colModel = new Ext.grid.ColumnModel(NewColumnModel());
    4) grid.reconfigure(store, colModel);

    this almost all works. the new headers are displayed. but it seems that the store columns have not been updated. the new data is only found in columns that are named the same as the columns defined in the original 'fields' definition.

    any ideas? or should I be doing this differently, and instead just destroying and creating a new store upon demand?

    edit:

    I'm using an Ext.data.JsonStore

    Code:
    store.reader.meta.fields = newFields
    I'm thinking that the above updates the fields for the reader, but not the fields for the proxy? Or for the store itself?


    I've tried removeAll() to clear the dataStore before loading new data, but still no luck.

    Now I destroy the store and create a new one every time the user changes the query params. Gets the job done, I guess!

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,624
    Vote Rating
    331
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Now I destroy the store and create a new one every time the user changes the query params. Gets the job done, I guess!
    If you need to change both the fields and the data then I think this is the approach I'd take too.

Thread Participants: 1

Tags for this Thread