View Full Version : trying to detect store update before displaying a grid

6 Jun 2013, 11:01 AM
Hi Folks,

This is my first post, and I'm relatively new to EXT JS. Please bear with me.

I am using EXT JS 4.1.3 on a linux system running mozilla/firefox 19.0.2.
This is in an EXT JS/Django development environment.

So I have 2 stores. One where I'm successfully retrieving information and
a second associated with a grid that I am calling gridStore.loadData(myData) with. The actual code looks like this:

var poseIndex = poseStore.find("id", poseId);
this.textureStatusData = poseStore.getAt(poseIndex).get('textureStatusGrid');

All that works fine. Here is the problem. Since this is all running asynchronously, I'm trying to detect when the poseStore (and/or txtStore) update is finished, the loadData call has occurred so that the grid is ready to display (the grid is updated and loaded then expanded based on a btn click callback).

I've used listeners a LoadMask on the poseStore:

this.gridLoadMask = new Ext.LoadMask(btn.up("#gridForm").el, { store: poseStore } );

with a listener on the 'hide' method, which is called but not in time.

I've used listeners ('write', 'load', 'refresh', and 'datachanged' on the txtStore) but the most reliable seemed to be 'datachanged', but that is called
before the poseStore actually returns the data.

txtStore.on("datachanged", function() {
//console.log ("calling texture status store on datachanged function");
this.textureStatusStoreDataChanged(btn, grid, txtStore);
}, this );

The first time through the code for loading and displaying the
grid all executes, even in the datachanged callback for the grid's store,
before the data is completely assigned.

Even if I combine the above into one call:


and in the txtStore 'datachanged' callback I check for the size of the
txtStore.count() it's still zero first time through.

Similarly in the 'hide' method for my load
mask on the poseStore fails to be called even
though the load mask is hidden when the store finishes loading,
the txtStore.count() is still zero, and if the grid is opened, it's empty.
I tried running the LoadMask on the txtStore but it returned immediately.

Any suggestions? I saw a post where someone had suggested:


but delay is not an option for loadData, and I'd have to change my
data format in the poseStore. Also, kinda kludgey to but in a hard wired

7 Jun 2013, 3:53 AM
To clarify, are you saying that you want to make sure that the poseStore is completely finished loading before you manipulate the txtStore?

7 Jun 2013, 7:22 AM
Yes, sorry, I probably should have been more clear.
However, since yesterday I was able to get this working by
changing my assignment order to the store itself.

So, probably it's not a EXT JS problem as much as a programmer implementation problem. :">

We can probably close this thread.