Carles Cabré Boixados
Posts: 0
Joined: Mon Jul 29, 2013 10:57 am

DataBinding a localStorage variable

Hello
I have a RestService binding with some controls in my page. Once data recovery data RestService keep localStorage variable.
I would like to check if I have a localStorage variable data and if so binding to controls and if not call RestService
Is possible to accomplish this called a Generic (custom JavaScript implementation) for example.
How you would have to do?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

DataBinding a localStorage variable

Hello,

On next doc you can find how to invoke the service: http://docs.appery.io/documentation/u....

[quote:]
to check if I have a localStorage variable data and if so binding to controls
[/quote]
You should check if you have the same value in localStorage and in the component. It's very simple to do. Can you provide additional information why do you want to do such validation?

[quote:]
if not call RestService
[/quote]
You can add additional lacalStorage variable and set it value "true" or "false" when service was invoked and then use this variable in validation.

You can use such validation on page load event.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

DataBinding a localStorage variable

Hi,

This question wasn't really answered properly and I am trying to do something similar. I have a list that I fill with a data service which returns json data. I also populate a localStorage variable with this same json data set. I want to be able to edit, add and delete from the localStorage dataset and then rebind the list to this dataset when done. How do I do this in javascript?

Thanks,
Aeneas

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

DataBinding a localStorage variable

Hi Aeneas -

This document should be helpful and shows how to change values in the local Storage variable:
http://devcenter.appery.io/documentat...

We don't have a code snippet this is something that should be coded by you.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

DataBinding a localStorage variable

Hi, I know how to change the values in local storage variable but I don't know how to bind the data in list back to this changed localstorage variable. How do I do this?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

DataBinding a localStorage variable

This is an example how to bind response to list, same with LSV.
Your data should be an array.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

DataBinding a localStorage variable

There is no example here? I have found a way to do it using echo.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

DataBinding a localStorage variable

You can use Generic service (http://devcenter.appery.io/documentat...)
1) Create generic service
2) On success send back array or object back (try to use static value for test purposes first);
3) Create response on test tab;
4) Use it in your mapping.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

DataBinding a localStorage variable

Yes thanks I have already found solution with the echo of a service

Return to “Issues”