gogagubi
gogagubi

Reputation: 1015

load store which loads all grids automatically

Lets say I have two(or more) same panels with same store in my app and they are on the screen. I changed something in one panel and want to refresh two stores at the same time. ok I know how to access with Ext.cmp() or up() or down() function but is it possible to just load store and refresh it everywhere? or how to do this? any example...

Upvotes: 0

Views: 29

Answers (1)

Tarabass
Tarabass

Reputation: 3152

It should happen automatically. The framework has one-way binding build into it out-of-the-box. You can test this by open a page with a grid and a loaded store. If you then go to your console and get the store and add a item, it will automatically be added to the grid or edit the record bind to the model on the store. Type in the console of your devtools of your browser something like this:

Ext.getStore('Users').add({id: 9238,firstName:'Goga',lastName:'Gubi'});

or

Ext.getStore('Users').getAt(2).set('firstName', 'Goga');

The fields and the store should correspond with your store and model off course.

As soon as your store is updated it will "rebind" the views to which the store is binded. This is why you always should use loadRecord on a form or get a reference to a store bind to a grid and use add() to add a record.

Upvotes: 1

Related Questions