lundi 24 novembre 2014

Ext.Ajax.request...

hello!!!

I have the following problem: in try to call a web service, it works and expected returns, but...

I'm working with a localStorage, but, when I try to store data in my localstorage, makes no action although there are no errors. this is de code:

this is in the controller class


Code:



onShowService: function(button) {

var user=new myApp.model.Employee ();

Ext.Ajax.request({
method: 'GET',
url: 'http://<server>/employees/10002',
params: { format: 'json' },
success: function (response, request) {
var jsonData = Ext.util.JSON.decode(response.responseText);

user.empNo=jsonData.empNo;
user.name= jsonData.firstName;

Ext.getStore('keyempleado').load();
Ext.getStore('keyempleado').add(user);
Ext.getStore('keyempleado').sync();

},
failure: function (response, request) {
alert('Not working!')
console.log('Response Status:- ' + response.status)
}
});

},

store class


Code:



Ext.define('myApp.store.Employee', {
extend: 'Ext.data.Store',
config: {
autoLoad: true,
autoSync: true,
model: 'myApp.model.Employee',
storeId: 'keyempleado',
syncRemovedRecords: true,
proxy: {
type: 'localstorage',
id : 'myEmployeeKey'
},

}
});

please help!!!

why my var user not shown in my localStorage?!??!



Ext.Ajax.request...

Aucun commentaire:

Enregistrer un commentaire