By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Showing the correct row in viewable are after search

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
VK
<a name="row999"><tr>...</tr></a>
and then:
document.location.hash = 'row999';
?
Jul 20 '05 #2

P: n/a
DU
F. Da Costa wrote:
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").scroll IntoView(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
Jul 20 '05 #3

P: n/a
DU wrote:
F. Da Costa wrote:
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").scroll IntoView(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.
DU

F DCG
Jul 20 '05 #4

P: n/a
VK wrote:
<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
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.