PDA

View Full Version : Saving changes in store.



nodun
17 Dec 2012, 5:07 AM
Hello,

Im learning Ext JS4 and during reading documentation i little "my version" of application shown in tutorial about MVC:
http://docs.sencha.com/ext-js/4-1/#!/guide/application_architecture

Table address:
http://178.216.203.62/extjs/MachineList/index.html

I can edit record there (ex. IP), then the edited record is shown, but i cant write it to "servers.json" file so changes will be visible after page refresh. I have no idea how to do that, do you have any ideas?

Proxy in store:

proxy: {
type: 'ajax',
api: {
read: 'app/data/servers.json',
update: 'app/data/updateServers.json'
},


reader: {
type: 'json',
root: 'servers',
successProperty: 'success'
}
}
});

Update user:

updateUser: function(button){
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();


record.set(values);
win.close();
this.getServersStore().sync();
}

mitchellsimoens
19 Dec 2012, 8:01 AM
The browser will not let any javascript to write to a file, well, really the server won't. You would need a sever side script like php to do this.