javascript - ExtJS - Saving nested data to .json file -
javascript - ExtJS - Saving nested data to .json file -
i created store, i'm loading nested info .json file:
var userstore = ext.create('ext.data.store', { model: 'user', storeid:'2013', autoload: true, pagesize: 4, proxy: { type: 'ajax', url: 'data/users.json', reader: { type: 'json', root: 'users', totalproperty: 'total' }, writer: { type: 'json' } } });
to add together new info grid use:
var asdfg = ext.getstore(mynewgrid); asdfg.add({lastname: nowa, firstname: nowa2);
everything works fine until refreshed page. after lose changes.
my model 'user' file:
ext.define('myapp.controller.users', { extend: 'ext.app.controller', border: false, views: [ 'user.list' ], init: function() { this.control({ 'viewport > panel': { render: this.onpanelrendered } }); }, onpanelrendered: function() { console.log('the panel rendered'); }});
is simple way save , commit new changes similar loading? start web utilize sencha cmd v.4.0.4
just utilize autosync:true
in store.
in case adding type:rest
proxy create easier.
look @ example: http://dev.sencha.com/deploy/ext-4.0.1/examples/restful/restful.html
javascript json extjs
Comments
Post a Comment