Page 1 of 1

Mapping JSONP return data to objects' properties on other pages than the calling one.

Posted: Tue Apr 02, 2013 6:19 pm
by Janko

Hi,
I made a JSONP call on to get a list of labels in the chosen language for populating all the labels.
I first tried with custom JS - bad idea not working, but in the end I created a REST service and it's working (actually the easiest solution!!) .
It is great think that you can map the returned data to labels, but now I have faced an issue.
My labels are on different pages and with REST service mapping I only have the first page's objects available as the service is bind to the calling page.
How can I map other page's object to the response data?

As per your documentation
http://docs.tiggzi.com/documentation/...

I also tried to store data in local storage var but.. I ended up with the same trouble, unless there is a service page-related that allows me to map vars as if they were returned by a REST call.

any clue?
I wouldn't go if possibile for specific Javascript (I have like 2 labels on the first page and more than 50 in the others!!)

Thanks! Marco.


Mapping JSONP return data to objects' properties on other pages than the calling one.

Posted: Tue Apr 02, 2013 6:45 pm
by Maryna Brodina

Hello! You can invoke the service on page 1, save the result to Local Storage, navigate to page 2. On page 2, read the values from Local Storage. This tutorial should help http://docs.tiggzi.com/tutorials/buil...


Mapping JSONP return data to objects' properties on other pages than the calling one.

Posted: Tue Apr 02, 2013 6:51 pm
by Maryna Brodina

As you have more than 50 labels here is what you can do:

  • create REST service without URL ( Data Type=json)

  • check Enable Echo

  • using options Sample echo response-- Automatically Create from Sample Response populate response parameters

  • add service on page

  • map results

    When you would need to show data saved to localStorage) - set new echo for service and call service :

    coderestserviceName.service.__requestOptions.echo = JSON.stringify(dataFromLocalStorage);
    restserviceName.execute({});/code