Showing the correct row in viewable are after search

F

F. Da Costa

Hi all,

I'm looking for a way to actually show a selected row *in* the viewable
area on the screen.

Situation:
1. Large table with autoComplete search fuctionality
2. On clickin a button (or whatever) the correct row is located and
highlighted accordingly. (all fine so far)
3. In a large table the actual entry is not displyed in the viewable area.
I have to scroll to get there. Hardly userfriendly.

If it is possible, *how* do I go about showing the highlighted row *on
screen* without having to scroll to it?

TIA
F DCG
 
D

DU

F. Da Costa said:
Hi all,

I'm looking for a way to actually show a selected row *in* the viewable
area on the screen.

Situation:
1. Large table with autoComplete search fuctionality
2. On clickin a button (or whatever) the correct row is located and
highlighted accordingly. (all fine so far)
3. In a large table the actual entry is not displyed in the viewable
area. I have to scroll to get there. Hardly userfriendly.

IMO, it is always best to give an url along with a brief description.
If it is possible, *how* do I go about showing the highlighted row *on
screen* without having to scroll to it?

TIA
F DCG

Assuming
(...)
<tr id="idTargetTableRow" ...>...</tr>
(...)

then
document.getElementById("idTargetTableRow").scrollIntoView(true);
will scroll the viewport to make that row viewable. Tested and working
in MSIE 6 for Windows, Mozilla 1.7alpha, NS 7.1, K-meleon 0.8.1.

DU
 
F

F. Da Costa

DU said:
IMO, it is always best to give an url along with a brief description.



Assuming
(...)
<tr id="idTargetTableRow" ...>...</tr>
(...)

then
document.getElementById("idTargetTableRow").scrollIntoView(true);
will scroll the viewport to make that row viewable. Tested and working
in MSIE 6 for Windows, Mozilla 1.7alpha, NS 7.1, K-meleon 0.8.1.
Thx, works like a charm.
MSIE 5+ does not falter either.
F DCG
 
T

Thomas 'PointedEars' Lahn

VK said:
<a name="row999"><tr>...</tr></a>
and then:
document.location.hash = 'row999';


?

No, that would be invalid HTML. TR may be only the child
of TABLE, THEAD, TBODY or TFOOT. Valid and better would be

<table ...>
...
<tr ...>
<td ...><a name="row999" id="row999" ...>...</a></td>
<td ...>...</td>
...
</tr>
<tr ...>
<td ...><a name="row1000" id="row1000" ...>...</a></td>
<td ...>...</td>
...
</tr>
...
</table>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top