Reputation: 3879
I'm designing a basic Sencha Touch app in order to get familiar with the environment. What I want to do is have my store (which currently looks like that below) read/write its data to/from a local JSON file. Also, upon loading, I want the store to be able to create the file if one does not currently exist. When I create a new "User" in my app I want the store to be able to write this data to the file.
Before now, my app stored its data using a localstorage proxy, but I want to change that to what I have described above.
App.stores.users = new Ext.data.Store({
model: 'User',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'users.json',
reader: {
type: 'json',
root: 'users'
}
}
});
Upvotes: 1
Views: 1466
Reputation: 2974
This can be only possible if you use phonegap or similar wrappers. As John said you can't use JavaScript to read/write files, but you can make a plugin that will read and write to files.
Upvotes: 1