aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes select a row in table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "select a row in table" Watch "select a row in table" New topic
Author

select a row in table

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
I have a table whose rows are dynamically added...

I want to select any row and listen to that row... how to do this in Javascript?

I get the table body this way...



Now what should be done??

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
How is the user selecting the row? SOunds like you need a checkbox and/or onclick.

Eric
Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
yes Eric...my intent is to select using click since I was denied using checkbox as per requirements...

but the problem is inside the javascript...

I create a row as...

row=document.getElementById("TR");

So am always getting the current row and unable to track the previously added rows...

How to get all previously added rows and move the mouse over my table and click a row and listen to onclick??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60072
    
  65

If you establish a click handler for each row, the TR element upon which you click will be available in the Event instance passed to the handler.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: select a row in table
 
Similar Threads
Some questions on "select for Update"
Mulitple fo:page-sequence
Java & MS Access
Row Selection problems with JTable
JTable and popup