Page 1 of 1

Lists

Posted: Tue Oct 01, 2013 8:15 am
by Ananya Raju

Hello,
In My App i am CReating a input Box which accepts all the values entered by the user and then Store all those values which is entered by the user in the form of a array in another local storage....

all the values that the user enters are already getting stored into a localstorage...called L1
so could u pls Help me out with a Js that would do the above...
I want a LocalStorage called L2 To contain all the information a user entered ie take the info from L1 in store it in a array in L2 ...pls help me out with the corresponding Js


Lists

Posted: Tue Oct 01, 2013 9:56 am
by Kateryna Grynko

Hi Ananya,

You can use the following code:
code// retrieve stored data (JSON stringified) and convert
storedData = localStorage.getItem("L2");
ArrayData = (storedData) ? JSON.parse(storedData) : [];
ArrayData[ArrayData.length] = localStorage.getItem("L1");
// store array to localstorage
localStorage.setItem("L2", JSON.stringify(ArrayData));/code


Lists

Posted: Thu Oct 03, 2013 5:06 am
by Ananya Raju

Thank You that works perfectly... now i would like to display all the array data one by one in a list ...wen a user enters data in a inputbox and clicks the + button it has to simultaneously be updated into the list(the list contains a label)


Lists

Posted: Thu Oct 03, 2013 7:45 am
by Kateryna Grynko

Hi Ananya,

Do you use Appery.io "mobilelist" component or want to use your custom component?


Lists

Posted: Thu Oct 03, 2013 8:38 am
by Ankush Ak

i am using Appery.io "mobilelist" component


Lists

Posted: Thu Oct 03, 2013 9:59 am
by Kateryna Grynko

Hi,

You can create GenericService with the following process function:
codeprocess : function(settings) { settings.success({"value":localStorage.getItem("L2")});
}/code
Add one more Response parameter "value", tick it as an array.
Now it can be mapped as an usual REST Service: http://docs.appery.io/documentation/u...