1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    8
    Vote Rating
    0
    sabhandari is on a distinguished road

      0  

    Default Problem with modifying store for GridPanel

    Problem with modifying store for GridPanel


    Hi All,

    I have setup a gridpanel by using simplestore by using the EXT.onready method.

    I had created my store as:

    Code:
    myData = [['xc','y','z','a','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','a','']]; storeModGenericList_30 = new Ext.data.SimpleStore({ 
      autoLoad:true,fields: [ 
    {name:  'col0'},{name: 'col1'},{name: 'col2'},{name: 'col3'},{name:  'col4'},{name: 'col5'},{name: 'col6'},{name: 'col7'},{name:  'col8'},{name: 'col9'},{name: 'col10'},{name: 'col11'},{name:  'col12'},{name: 'col13'},{name: 'col14'},{name: 'col15'},{name:  'col16'},{name: 'col17'},{name: 'col18'},{name: 'col19'},{name:  'col20'},{name: 'col21'},{name: 'col22'},{name: 'col23'},{name:  'col24'},{name: 'col25'},{name: 'col26'},{name: 'col27'},{name:  'col28'},{name: 'col29'},{name: 'col30'},{name: 'col31'},{name:  'col32'},{name: 'col33'},{name: 'col34'}    ] 
    
    }); 
    storeModGenericList_30.loadData(myData);
    After user performs some operations on the page, I am modifying the gridpanel without refreshing the page.
    The user operations results in addition of more fields to store above and I load the modified data again by using the following code:
    Code:
    window['store'+divId].loadData(rows);
    After that I am hiding empty columns using a for loop over the grid columns by using columnmodel.

    The problem I am facing is that when I reach the end of loop and try to show/hide the last column (which is the newly added column), a javascript error is returned and page gets refreshed.

    Does the re-loading of fresh data to store not automatically add extra column in the gridpanel. Here is how I am performing show/hide operation:
    Code:
    window['grid'+divId].getColumnModel().setHidden(j, false);
    Any help would be greatly appreciated.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The columns are predefined and are not run based on the fields on the store. If you want to add more columns to a grid, you should use the reconfigure method on the grid.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread