Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

How to access values from other columns in a list item

I have a list component, in it is a series of list items generated from a rest service. in the list item there is a grid, 3 columns. In the first column I have a code (in a label), second column has a description (also in a label). The 3rd column is a button. When I click on the button I go to a new page. I'd like to display the code & the description from the same line as the button to show on the heading of the new page. I'm sure I'd have to do this via a couple of local storage variables. The problem I'm having is getting the values into the local storage variables. I've tried something like Appery('code').text() but all I get is a blank field. I even tried a generic service but all I got there was a list of all the codes - not the one corresponding to the button clicked. Any other ideas ?

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

How to access values from other columns in a list item

Hello!

On button click add the following code prevar text = $($(this).parents()[2]).find("[name=code]").text();/prewhere "code" - label name

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

How to access values from other columns in a list item

Works brilliantly but one last question. I can see your constructing the name of the field so as to get the text but what does the "parents()[2])" mean ? I'm kind of new to javascript and just trying to understand/learn if that's ok.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to access values from other columns in a list item

Hello Bob,

You could find description here: https://api.jquery.com/parents/#paren...

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

How to access values from other columns in a list item

Thanks for that (I think)

Return to “Issues”