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

Filling list within collapsible

I have a list of collapsibles which I populate from a list returned from a data table. Based on an id returned from the collapsible I want to populate a list within the collapsible. I have added a jscript to the mapping of the collapsible that calls the populate list service within collapsible based on the id returned for the collapsible list item. The list within the collapsible is always over written with the last time the service called and therefore I end up with the same list in all collapsibles rather than the one that relates to that collapsible. Is there a way to only update the list within the collapsible with the relevant data list?

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

Filling list within collapsible

Hi Aeneas,

Could you please show the code that you are using in the mapping?

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

Filling list within collapsible

Hi Illya,

I have attached 3 screen shots.

This is first of the data mappings to fill the first collapsible including the js to write id to localstorage variable and then call the 2nd data list mapping.

Image

This is the data list mapping using the localstorage variable mapped above.

Image

This is a screenshot of the design of the objects.

Image

The problem is the list is always the same for every item in the parent collapsible so its just being overwritten each time with the last one it runs.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Filling list within collapsible

Hi Aeneas,

It's better not to use localStorage. I would recommend that you pass data directly to service. That is, invoke service named serviceName on each horseID mapping using the following JS:preserviceName.execute({"data": {"where":{"horseID" : value}}});/pre

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

Filling list within collapsible

I have added this to the horseID mapping

alert(value);
listOwners.execute({"data": {"where":{"horseID" : value}}});

I get the value for alert but the list is not being populated with any data from the listOwners Service.

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

Filling list within collapsible

Also if I remove the data part as such

listOwners.execute({"where":{"horseID" : value}});

I get every owner record so the where clause doesn't work

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

Filling list within collapsible

Aeneas,

You need to replace 'value' in the code Katya has provided with the value you want to be searched.

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

Filling list within collapsible

Hi yes I have done this as the value is coming from the mapped horseID

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

Filling list within collapsible

Please show us what you have tried. Screen shots of mapping will help.

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

Filling list within collapsible

As suggested I am calling the listOwners service for every record returned in listHorses service as screenshot shows. The listOwners poluates a list within the collapsible that the listHorses does.

Image

Return to “Issues”