PDA

View Full Version : [FIXED-137] Only 2 events on data Stores?



jeroenvduffelen
30 Jun 2010, 4:37 PM
I'm missing a lot of events on the Stores/Proxies/Readers... There is no "load", "beforeload", "save" etc. like in ExtJs 3.2.1.

jeroenvduffelen
7 Jul 2010, 1:18 PM
*kick*

Sesshomurai
7 Jul 2010, 2:35 PM
Additionally, the 'datachanged' event gets fired twice for a single load.

Without the 'load' semantics, using stores will be hard.

Also, there is a bug whereby the url: field is not conveyed when used as a default config value such as:



this.store = new Ext.data.JsonStore({
// store configs
autoDestroy: true,
url: '../jsp/data.jsp', <---- this does not get set correctly internally and buildUrl() throws an error
storeId: 'menu',
// reader configs
root: 'items',
idProperty: 'text',
fields: ['text','card','source']
});

jeroenvduffelen
7 Jul 2010, 11:17 PM
@Sesshomurai the way a store works is like this:




booksLibrary = new Ext.data.JsonStore({
autoLoad: false,
getGroupString: function(record){
return record.get('title')[0];
},
model: 'book',
proxy: {
url: '/books.json',
type: 'ajax',
reader: {
root: 'books',
type: 'json',
},
writer: {
type: 'json',
}
},
storeId: 'books',
});



instead of fields you can use models:




Ext.regModel('book', {
idProperty: 'id',
fields: [
{name: 'id', type: 'string'},
{name: 'title', type: 'string'},
{name: 'slug', type: 'string'},
{name: 'author', type: 'string'},
{name: 'chapters', type: 'object'},
],
});

Sesshomurai
8 Jul 2010, 3:14 AM
Yeah. I see they have the model pattern too. But the example I posted above came directly from the Touch API for JsonStore. I tried it, and it doesn't work cuz of a bug is all. But otherwise, it works the other way too. Apparently.

edspencer
15 Sep 2010, 8:52 PM
We've added several additional events to Stores recently, including beforeload, load, add, remove, datachanged and beforesync. Some of these will become available as of the next release. Please leave additional comments if you are missing events that would help you write your applications.