PDA

View Full Version : Store empty after load although success callback gets a non empty records array



ohcibi
14 Nov 2014, 4:50 AM
Hi,

I have
File hasMany Comment. I have a gridview of files and underneath it a gridview of a files comment. I
reconfigure the lower gridviews store with a files
comments() store whenever a file in the upper gridview is selected. When adding a new commit, I want to reload the lower gridviews store (which already works for the files itself), to show all comments, including the new one.

?? I checked that the
load call actually makes a correct ajax request with a correct response
?? I added a
callback to the
load method from the store and I can see that the first argument contains all the comments that were loaded via ajax. I.E. the reader works correctly and ext was able to create a bunch of models with correct data
?
store.count() returns 0
? the gridview is empty after the call to load

Whats wrong here?

slemmon
17 Nov 2014, 1:05 PM
I think the best way to help out is to review your code with you.
Can you post a test case either inline here or better yet at https://fiddle.sencha.com including the store (and model class if you have one defined), grid, and example data?

ohcibi
19 Nov 2014, 1:13 AM
I found out that the model was missing the field definition for the associated_id. If this field is mandatory it should be a) added to the docs and b) extjs should throw at least a warning that the field is missing in that case.

So anyone who runs into this from google:

make sure that your ext-model contains all key fields (i.e. primary key and any foreign keys) with the correct type
make sure you add a reader with a 'root' property defined to your proxy in case the data is wrapped in the json response


Thanks for pointing me to the extjs fiddle.