PDA

View Full Version : Grid reconfigure method



jeffiel
19 Mar 2007, 6:31 PM
How safe is the grid's "reconfigure" method?

Here's how I'm trying to use it, but it's providing me with funky results. Is there a better way to do this:

Based on some user input, I need to add or remove columns to/from the grid. Here's what I do:

1. I reconstruct the data (in a memory array), pushing on values for new columns.
2. Create a new MemoryProxy based on the new data.
3. Create a new Record definition that pushes any newly created columns.
4. Create a new ArrayReader with the new Record definition.
5. Create a new Store with the ArrayReader and the MemoryProxy. Call load() on the store.
6. Create a new ColumnModel adding any new columns, and removing unneeded columns
7. Call (editor)grid's reconfigure with the new column model and store.
8. Call grid's render(), since reconfigure doesn't seem to render the defaults correctly

This all works out ok, execpt for this strange behavior:

1. Clicking on cells to edit immedialy stops editing. Hitting enter still works to begin editing.
2. Tabbing through the table skips certain columns. Reverse-tabbing skips other columns.

I'm investigating all this, but if anybody has some pointers, such as "never use reconfigure", I'd appreciate it.

jeffiel
19 Mar 2007, 7:23 PM
It seems that calling render on a grid that's already rendered was somehow the culprit. I've switched to calling getView().refresh()

Note, the reason for the rerender/refresh is that there are multiple grids, some drawn some not... so I call something when I switch visible grids to pickup the changes. Render caused problems, refresh doesn't seem to.

-jeff

jeffiel
27 Mar 2007, 9:59 PM
Hi,

Still having trouble getting a reconfigured grid to render. Anybody have advice? Thanks!

-jeff