Well, I am fixated on what should be the main task in ExtJs. I am writing a simple login script that sends a username / password combination to a RESTful web service and gets a GUID if the credentials are correct.
My question is: do I use a model proxy or a store proxy?
As far as I understand, models are one record, while stores are designed to process datasets containing more than one record. If this is correct, then the Model proxy seems to be the way to go.
After Sencha's documentation at http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model, the code will look something like this:
Ext.define('AuthenticationModel', { extend: 'Ext.data.Model', fields: ['username', 'password'], proxy: { type: 'rest', url : '/authentication' } });
So far, everything is in order, until the next step:
//Use the configured RestProxy to make a GET request AuthenticationModel.load('???', { success: function(session) { console.log('Login successful'); } });
The load () method for the Model class is a static call waiting for a single unique identifier. Logins usually depend on two factors: username and password.
Thus, this means that the store proxy is the only way to verify the account name of the username and password in ExtJS. Can anyone check and explain? Any help to figure this out would be greatly appreciated.
restful-authentication extjs extjs4 model store
mrtedweb
source share