Page 1 of 1

How to create a mapping as attached via javascript?

Posted: Tue Aug 21, 2012 8:48 pm
by Bernie

How to create a mapping as attached via javascript?

Posted: Tue Aug 21, 2012 8:56 pm
by maxkatz

Can you tell us what exactly you are trying to do? What functionality to add?


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 12:35 am
by Bernie

I do have a json file with different categories like Automotive, Hotels and others.
On one screen all those categories are already listed. Depending what one is choosing from this list, I want to display the result (all hotels or all car garages...) in a new screen. How can I change the content from the new screen from hotels to garages? I thought I can store the choice from the first screen in a variable and pass it over to the new screen to bind the result to the list.

Saw an example in the docs which was working with rest requests, but I do have only the response from the rest service.


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 12:43 am
by maxkatz

So, the entire response (all categories) you get in the initial request?


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 1:05 am
by Bernie

Yes, here you can see the different categories.
Each category deos have the same attributes. Image


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 6:07 pm
by maxkatz

You could save the entire JSON response in local storage and then pick the category that you need on the next page.


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 7:07 pm
by Bernie

please, can you specify 'picking the category'. Do I have to use some jacascript for that?


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 8:05 pm
by maxkatz

Here is a simpler way to do this.

You can define a separate service for each category. Service input would be the same for all. Service output would be different. For example, if you need to display the Virtual Tour category, the service response would be this:

code
Geocockpit
__Virtual Tour
/code

(the __ is added for formatting)

For a service that shows the Popular Sites category, the response would be:

code
Geocockpit
__Virtual Sites
/code

and so on. As the service output doesn't have any other categories, those will be basically "dropped".

Every page would hold one category and use one service.


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 8:32 pm
by Bernie

HI Max,
unfortunately it's not working that way. Will read the categories by jquery from the JSON file and put the results manually into the list.

Thanks for your help.


How to create a mapping as attached via javascript?

Posted: Wed Aug 22, 2012 8:43 pm
by maxkatz

You would still read the entire response each time but on the response side, you will only return the required category.