PDA

View Full Version : Best practice for delaying grid rendering until 2 data streams have been read



misterblinky
16 Aug 2011, 9:28 AM
I have an EditorGridPanel which is getting its raw table data and ColumnModel data from two distinct sources via two distinct ScriptTagProxy calls -- which means that i have two distinct streams of data that must be read before I render my EditorGridPanel.

My question is this: What's the best practice for how i ensure that these streams have been read before I render my grid? As far as i know, the GridPanel does this automagically for the "store" property -- i.e., it waits until the specified store is populated. How to make it do the same for its "cm" property?

I could set up some nasty looping to listen for variables written to by the "load" events of the various Stores and when the variables are 'true' for example, i could explicitly .render() the grid, but that seems very inefficient for lots of reasons.

Assume I have



var grid = new Ext.grid.EditorGridPanel({
store: tableDataStore,
cm: getGridColumnModel(tableDefinitionStore),
...
}

and the getGridColumnModel function just creates a ColumnModel from the store.

thanks for your thoughts.