This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
I have a table (scrollable) inside a div. At any time, only 5 rows are visible and to view rest of the rows the user have to scroll down. Suppose user scrolls down to 16th rows and selects it, I change the "class" of the TR element that row as "highlight", in order to highlight it. Now my problem is that I should keep that highlight row at the top of currently visible enteries. i.e. in current scenario, since I selected the 16th row, div should show 16th element and the next four (i.e. 17th,18th,19th,20th) [since I show only 5 rows at a time]
I have the index of 16th row and I use this index to scroll div upto that element using this code on body onload : divElement.scrollTop = (index * 20); where index is 16 (in this case) and 20 is approx height of each TR. But this doesn't works fine. Ideally I would like to know if I can know the position of the highlighted TR. i.e. if the hightlighted TR is at XX position, I would simply use divElement.scrollTop = XX
Is this possible or any work-around?
Joined: May 30, 2002
Resolved, the TR attribute I was looking for was "scrollHeight". It gave me the height of that TR.