Finding the value of an element within a dynamic table

This forum contains topics that were moved from Get Satisfaction
Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Finding the value of an element within a dynamic table

Post by Andy Parker »

I have a list that is filled from a REST DB source.

Each table entry contains other grid components and a DIV that contains more grid components.

Here's an example
Image
The Labels are fed from a rest call to the DB, label2 is an array of labels and all are dynamically created as you would expect. This works well.

My question:
If the user taps on Button (which is within the table row dynamically created, how do I identify the name of the elements label1 and label2 so I can either modify or get their values/contents?

I've tried var lable1text = $(this).find("[name=label1]").text();
etc but it returns nothing.
Is the fact that the data is in a DIV causing me the problem?

Any help would be massively appreciated.

anywhere
Posts: 39
Joined: Tue Sep 08, 2020 3:04 am

Re: Finding the value of an element within a dynamic table

Post by anywhere »

I also would like to know how you reference agrid within a div.

Serhii Kulibaba
Posts: 145
Joined: Tue Aug 27, 2013 1:47 pm

Re: Finding the value of an element within a dynamic table

Post by Serhii Kulibaba »

Hello,

Please use the following JS code for that:

Code: Select all

var lable1text = $(this).closest("[name=my_grid]").find("[name=label1]").text();

here "my_grid" - the name of the grid, which are generated automatically with a mapping of the array you use here

Post Reply