View Full Version : Store with Data Model

3 Jan 2012, 11:31 AM
So I created a Data Model with a REST Proxy and JSON Reader.
Very cool.

Now trying to create a store with that model, does not work.
What I want is something like this....

Ext.define (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext-method-define)('User', { extend: 'Ext.data.Model (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Model)', fields: ['id', 'name', 'age', 'gender'], proxy: { type: 'rest', url : 'data/users', reader: { type: 'json', root: 'users' } } }); // Uses the User Model's Proxy Ext.create (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext-method-create)('Ext.data.Store (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Store)', { model: 'User' });

The only option I have found is creating a "Store" but that defaults to having an AJAX proxy.
Would it be possible to link the Model to the store rather than the Proxy.
It would be awesome to link so that the model could be used on multiple stores.

Are there plans to do something like this?

10 Feb 2012, 4:52 PM
Yes, Stores are now linkable to Models.