Unanswered: Fetch all records from store using localstorage proxy
Unanswered: Fetch all records from store using localstorage proxy
Hi
I have created a form using sencha touch 2.1 having three Textfield. i want to do user insert info into textField and save into store.then fetch all the records from store and display on console.i try below code but it gives errors. "Uncaught SyntaxError: Unexpected token for".
listeners:
{
tap:function()
{
var i,row;
Ext.Msg.alert('Hi');
var store = Ext.create('Ext.data.Store',
{
model: 'LoginDemo.model.User'
});
var n=Ext.getCmp('txtname').getValue();
var a=Ext.getCmp('txtadd').getValue();
var e=Ext.getCmp('txtemail').getValue();
//loads any existing Search data from localStorage
store.load();
//now add some Searches
store.add({name: n,add: a,mail:e}),
//finally, save our Search data to localStorage
for(i=0;i<store.getAllCount();i++)
{
row=store.getAt(i);
store.sync();
console.log(row);
}
}
}
},
can you suggest me what i do wrong in code.
Thanks
i used array and push element at the end of array now it works.
but when i close the browser all the records flush away from an array. so what is the use of localstorage.i want data persist in localstorage how do i achieve that.