Results 1 to 2 of 2

Thread: Saving form updates in local JSON file

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Location
    Singapore
    Posts
    7
    Vote Rating
    0
      0  

    Default Saving form updates in local JSON file

    Hi All,

    I'm following the sencha website example "account manager" and I'm trying to update the local JSON file after the form cell content is modified. However, I can only see the update results in chrome network POST request, the local json file remains unchanged. How can I update my local JSON file?

    My store:

    Code:
    Ext.define('AM.store.Users', {
    extend: 'Ext.data.Store',
    model: 'AM.model.User',
    storeId: 'myStore',
    autoLoad: true,
    autoSync: true,
    proxy: {
    type: 'ajax',
    url: 'data/users.json',
    api: {
    read: 'data/users.json',
    update: 'data/users.json'
    },
    reader: {
    type: 'json',
    root: 'users',
    successProperty: 'success'
    },
    writer: {
    type: 'json',
    root: 'users',
    encode: true,
    writeAllFields: false
    },
    actionMethods: {
    create: 'POST', read: 'POST', update: 'POST', destroy: 'POST'
    }
    }
    });


    My controller:
    Code:
    init: function() {
    this.control({
    'useredit button[action=save]': {
    click: this.updateUser
    }
    });
    },
    
    updateUser: function(button) {
    var win = button.up('window'),
    form = win.down('form'),
    record = form.getRecord(),
    values = form.getValues();
    record.set(values);
    win.close();
    if (record.dirty) {
    record.commit();
    }
    this.getUsersStore().sync(); 
    }
    Thanks a lot for your help!

  2. #2
    Sencha User
    Join Date
    Oct 2012
    Posts
    28
    Vote Rating
    1
      0  

    Default

    You simply can't do this cause of security

Tags for this Thread

Posting Permissions

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