marvinbleiberg
Posts: 0
Joined: Wed Jan 25, 2012 8:16 pm

Question on mapping array of values via REST, to grid

(Sorry for duplication, but this shows as being "answered", so I'm creating a new thread for it).

Maryna-
I think I've just figured out that a grid itself does not hold any data. Rather, each cell in the grid contains whatever object (Text Box, Label, Popup, etc.) is placed in that cell - and mapping of data (to/from services is done to the individual object (which happens to reside in a cell inside the grid).

Assuming I understand that correctly, If I have a grid with 3 rows and 5 columns that would be 15 individual values to map from a service, and would require 15 objects to be created. The example in "Home → Documentation → Using a REST service on a page" shows an array being mapped from a service to a "grid", but it shows 2 values being mapped to 2 specific labels inside the grid. So I don't see how that can loop through multiple rows automatically, for an undetermined number of rows, if each destination label must be created and mapped in advance?

Can you advise?
thx-
MB

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Question on mapping array of values via REST, to grid

Hello!
No need to take into account topic status, we always reply, but sometimes it takes time:)

The main thing is the mapping of element marked in response structure as Array (in docs example it's $) to a table. This allows you to create table copy for each element from response array. In created Grid copy all elements are in their places (in cells). If there is mapping to some elements in Grid, these elements value is changed. Is there any specific problem you have with that?

marvinbleiberg
Posts: 0
Joined: Wed Jan 25, 2012 8:16 pm

Question on mapping array of values via REST, to grid

So after I map each of the 5 values in the REST response to one of the text fields I've inserted in the 5 grid cells in the first row -

If the rest response includes 3 rows, the grid will display then with 3 rows of values (even though I only created 5 text objects, not 15)? Is there a standard array-like way (e.g., cell A1, A2, etc.) to address each of the 15 cells (or 20, 25, 30, etc. - depending on # of rows in the REST response) ?

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

Question on mapping array of values via REST, to grid

Hi Marvin,

Yes, you add as many components to a Grid cells as many columns you map. Rows will be multiplied automatically. Don't forget to map an array itself to a Grid.

As for accessing components - this should be helpful: https://getsatisfaction.com/apperyio/...

marvinbleiberg
Posts: 0
Joined: Wed Jan 25, 2012 8:16 pm

Question on mapping array of values via REST, to grid

I would need to write a loop in javascript to create an array and assign values based on the number of rows and columns, correct?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Question on mapping array of values via REST, to grid

Hello! If we understand you correctly you can use mapping only, but if you have more complex page structure you can always fill in values with JS.

Return to “Issues”