Page 1 of 1

Accessing data from a Grid created from REST service data

Posted: Mon Dec 23, 2013 2:39 pm
by Andy Parker

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


Accessing data from a Grid created from REST service data

Posted: Mon Dec 23, 2013 3:51 pm
by Maryna Brodina

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


Accessing data from a Grid created from REST service data

Posted: Mon Dec 23, 2013 3:53 pm
by Andy Parker

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


Accessing data from a Grid created from REST service data

Posted: Mon Dec 23, 2013 4:08 pm
by Maryna Brodina

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


Accessing data from a Grid created from REST service data

Posted: Mon Dec 23, 2013 4:51 pm
by Andy Parker

fantastic!

Many thanks for this, worked like a dream!

regards

Andy.