GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes get the selected row value from the icon which is within Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "get the selected row value from the icon which is within" Watch "get the selected row value from the icon which is within" New topic
Author

get the selected row value from the icon which is within

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I have a table and when clicked on a row, that row will be highlighted, then I click a button to create a child window with clicked row information filled in it. The way to know values in selected row is because I can find out by looking for highlight class attributes associated with the table cells.

Now when I add a popup icon to each row, and want to click it to open a child window, there is no row being clicked, so I can't get the selected row values. The popup icon is within the row. But when I click the icon, its row is not actually selected. Does someone know how to solve this problem? I want to know how to get the row values whose icon inside is clicked.

Thanks.


SCJA, SCJP5.0, SCBCD, SCWCD
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
See if one of these would work in the button click event

alert(this.offsetParent.offsetParent.id);
alert(this.parentNode.parentNode.id);

Eric
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
Thanks Eric,

My table has a structure like <table><tr><td>, where popup icon is in <td>

If I use this alert(this.offsetParent.offsetParent.id);
I will get table id

If I use alert(this.offsetParent.id);
I will get td id

I tried alert(this.offsetParent.parentNode.id);
Then finally I got tr id.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: get the selected row value from the icon which is within