Results 1 to 2 of 2

Thread: Problem with modifying store for GridPanel

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    8
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,411
    Vote Rating
    1290
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

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