0

I have a grid panel that is instantiated on multiple tabs. Each instance of the grid panel has the same columns, but different data. I am trying to use a state manager to save the column settings like column order, and width.

The problem is that ExtJs saves the column's (generated)id in the database for the first tab, and the next tab generates new ids for the columns and can't find state information in the database for those new values. So I can't save and load stateful information.

Edit: I tried using itemIds instead of ids because itemIds are contained within the container so it won't be duplicate id if on multiple tabs. But Ext seems to generate ids if ids are not present, regardless of the itemId property. I added this part in case it gives a better view of what I'm trying to accomplish: The database needs for all tables to have the same id, but Ext needs for them to be different.

LawZero
  • 91
  • 1
  • 3

1 Answers1

1

The way that I have gotten around this in the past has been like this...

    id: 'tab_panel_'+this.somthing_that_is_unique_like_a_table_name

which gives me something like this...

    <div id='tab_panel_my_first_table'>other information</div>
    <div id='tab_panel_my_second_table'>other information</div>
wpenton
  • 91
  • 10
  • i think the issue is that the IDs are NOT the same but the OP wants them to be the same, which is not a good idea. – dbrin May 21 '13 at 21:37
  • That would be a problem though because when the user makes a change on the first tab, the database will save the column settings for the column named 'tab_panel_my_first_table'. Then when the second tab tries to load settings it will look for 'tab_panel_my_second_table', which won't be there. – LawZero May 22 '13 at 09:51
  • not if they share the same store that makes an AJAX call to load the data... the ID has nothing to do with loading the data. there are ways around it ;-) – wpenton May 22 '13 at 13:24
  • the point I was trying to make was that you would need to put a unique identifier on the end of the ID to fix the problem the OP has, wether it is a table name or whetever identifies that particular set of data. OP said that columns are the same but data is different, I am sure that there would be something he could use just so long as it is 100% unique even if it is 'tab_panel_part_of_sql_where_clause_used_to_generate_data' – wpenton May 22 '13 at 13:41
  • sorry, I didn't see the part where the ID is saved into the DB. so let me get this straight, is the tab panel treated like it's column in the DB? would you be able to put up a code snip? – wpenton May 22 '13 at 14:24
  • Hey, sorry for the delay. Each GridPanel is a tab. The problem is that each GridPanel uses the same columns, so when I close one, I think it destroys the columns that are already in use. I'm working on a code snippet now. – LawZero Jun 07 '13 at 14:42