Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Accessing data from a Grid created from REST service data

Hi,

I have a rest service that is mapped to several elements in a grid.

So if I read 10 database records, I get 10 rows of data display (each row contains around 5 label objects that are filled with the data.

If a user clicks on one of these rows, I need to save the data to local storage variables,

How do I address the individual rows to get at, for example the fourth row of data?

My grid is called grid1 - this has the $ mapped to it.
The grid has 2 columns and on each row of the grid, there are 6 components that receive data, 5 are labels, 1 is a button.

eg

-------------------------

|.image1..| button1 |
|...............| label1 |
|.............. | label2 |
|...............| label3 |
|...............| label4 |
|...............| label5 |

-------------------------

What I need to know is how I reach the 4th row of data returned?

eg
var result = Appery("label1").text() - but for the 4th row returned?

regards

Andy

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

Accessing data from a Grid created from REST service data

Hello! Try this way pre$("[name=mobilegridName]").eq(4).find("[dsid=mobilelabelName]").text();/pre

Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Accessing data from a Grid created from REST service data

thanks for this, but how will I know if the 4th row has been clicked?

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

Accessing data from a Grid created from REST service data

You can add event on Click on Grid and in event "this" will refer on Grid you've clicked. So you can use the following code pre$(this).find("[dsid=mobilelabelName]").text();/pre

Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Accessing data from a Grid created from REST service data

fantastic!

Many thanks for this, worked like a dream!

regards

Andy.

Return to “Issues”