Hello!
I have been trying desperately for a couple of weeks now to get information from the next row in a table. Here’s the layout:
Outer grid: “songsetgrid_out”, 1 row, 1 column
Inner grid: “songsetgrid_in”, 1 row, 4 columns
For testing purposes, column 2 of “songsetgrid_in” has one label, “songtitle.” The grid is populated from the database. Column 4 has a button, which runs Javascript. Using the following code, I can get info from the current row:
var table = jQuery(this).closest("table");
var row = table.find("tr").eq(0);
var songLabel = row.find('[name="songtitle"]');
var songTitle = songLabel.text();
console.log(songTitle);
However, trying to use the following code, I am unable to access the next, previous, or even current row:
var goalRow = x;
var table = jQuery(this).closest("table");
var row = table.find("tr:eq(" + (goalRow - 1) + ")");
var songLabel = row.find('[name="songtitle"]');
var songTitle = songLabel.text();
console.log(songTitle);
In fact, changing the eq value at all (ex: var row = table.find("tr").eq(1);) returns no results. I’ve also tried changing the value of closest("table") to closest("songsetgrid_out") and closest(“songsetgrid_in”), and I also get no results. Please help!
Thanks,
Randy