Results 1 to 4 of 4

Thread: Getting empty array for no reason

  1. #1
    Sencha User
    Join Date
    Mar 2008
    Posts
    150
    Answers
    1
    Vote Rating
    1
      0  

    Default Getting empty array for no reason

    Hello,
    Why do I get an empty array on the red line? I want the out put of the red line to be the same as the blue line. Thanks for your help.

    Code:
    copyFromGrid = Ext.ComponentQuery.query("#" + copyFromGrid)[0];
    
    console.log(copyFromGrid.columns); => array of Column objects
    
    grid.reconfigure(copyFromGrid.getStore(), copyFromGrid.columns);
    
    console.log(copyFromGrid.columns); => Empty array

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,385
    Answers
    3997
    Vote Rating
    1540
      0  

    Default

    Why are you executing reconfigure with the same store and columns?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Mar 2008
    Posts
    150
    Answers
    1
    Vote Rating
    1
      0  

    Default

    I have three grids: User, Role, and Workspace. Workspace is to model the one to many relationship between users and roles (one user can have many roles). When double clicking user's row, I want Workspace to have the same store and column as that of the role grid. That way I can then drag and drop roles between the Role grid and Workspace grid. This is an interactive way of editing roles for a user. Role grid here is the "copyFromGrid" in the code. grid in "grid.reconfigure" is the Workspace grid.

    Because copyFromGrid.columns got cleared out (empty array), Role grid's headers disappear after I double click a row in User grid.

    Hope that clarifies.

  4. #4
    Sencha User
    Join Date
    Mar 2008
    Posts
    150
    Answers
    1
    Vote Rating
    1
      0  

    Default

    This did the trick. Any better way to do this?

    Code:
    copyFromGrid = Ext.ComponentQuery.query("#" + copyFromGrid)[0];
    Ext.each(copyFromGrid.columns, function(column, index) {
    	columns.push(column.cloneConfig());
    });
    grid.reconfigure(copyFromGrid.getStore(), columns);

Posting Permissions

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