PDA

View Full Version : [5.0.0] GridPanels with Bound Chained Stores Have Views Drawn Twice



bobringer
29 May 2014, 8:44 PM
Ext version tested:
Ext 5.0.0.736


Browser versions tested against:
Chrome Safari Firefox

Description:
Chained stores in a ViewModel that are bound to a GridPanel cause the GridPanel's View to be drawn twice. If the binding is replaced with a direct reference to the parent's storeId, the grid panel is only drawn once

Steps to reproduce the problem:
See fiddle attached below

The result that was expected:
GridPanel's View should be drawn once

The attached fiddle shows two grids, one with a bound store, the other one with an explicit store configuration. The "refresh" event on the grids writes the following to the console.

[Log] Bound Store Updated (fiddle.sencha.com, line 61)
[Log] Bound Store Updated (fiddle.sencha.com, line 61)
[Log] Configured Store Updated (fiddle.sencha.com, line 61)

See the following Fiddle:

50a

evant
29 May 2014, 9:06 PM
It's fairly difficult to call this a bug. The view model notifications run asynchronously, so the first time the view refreshes it has the empty store attached to it. Once the VM fires, the chained store gets bound (after render) to the parent store.

You would get the same behaviour had you not configured the grid with a store. The difficulty is that you don't know when the bind will show up.

bobringer
29 May 2014, 9:18 PM
That's what I thought at first...

So I added a column renderer to output the firstName field on every pass. It appears that the data is already available in the chained store the first time the view refreshes.

I've updated the fiddle to reflect this.

Here's my output:

[Log] Jimmy (fiddle.sencha.com, line 67)
[Log] Robert (fiddle.sencha.com, line 67)
[Log] John Paul (fiddle.sencha.com, line 67)
[Log] John (fiddle.sencha.com, line 67)
[Log] Bound Store Updated (fiddle.sencha.com, line 61)
[Log] Jimmy (fiddle.sencha.com, line 67)
[Log] Robert (fiddle.sencha.com, line 67)
[Log] John Paul (fiddle.sencha.com, line 67)
[Log] John (fiddle.sencha.com, line 67)
[Log] Bound Store Updated (fiddle.sencha.com, line 61)
[Log] Jimmy (fiddle.sencha.com, line 67)
[Log] Robert (fiddle.sencha.com, line 67)
[Log] John Paul (fiddle.sencha.com, line 67)
[Log] John (fiddle.sencha.com, line 67)
[Log] Configured Store Updated (fiddle.sencha.com, line 61)

evant
29 May 2014, 9:23 PM
That's not the case in the latest code. In the nightly, on the first refresh there are 0 items in the store.

bobringer
30 May 2014, 8:19 AM
Great, thanks.

Using the nightly build, it clearly solves the problem.

Which brings up another point (which I'm sure you're sick of hearing ;-) ) This may have been fixed a month and a half ago, but since we don't have access to updated builds... as far as I'm concerned I found and reported a valid bug. I spent the time to identify that it exists, I then spent time creating the fiddle... creating the bug report... and you spent the time to do the analysis on it as well. In my code it's not fixed since I don't have access to anything more recent than the .736 build. Access to something more recent would have saved both of us a whole lot of time.

All that being said... it's good to know that I can just leave the old code I was using (with the bindings instead of explicit store declaration). I can live with the performance issues until I can build my code against a new version of Ext.