Results 1 to 3 of 3

Thread: Ext.Ajax.request...

  1. #1

    Default 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?!??!

  2. #2
    Sencha Premium User lumberjack's Avatar
    Join Date
    Nov 2014
    Location
    Kansas
    Posts
    781

    Default

    Here's a fiddle demoing the localstorage proxy. Note that the proxy is configured in the model definition, not in the store instance.


  3. #3

    Default

    ok, thank you!!!! I resolved the problem!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •