Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get the selected row value from the icon which is within

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic