WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 How to determine if the row is visible?, Vadim, October 11, 2003
     Re:How to determine if the row is visible?, Erik Arvidsson, October 12, 2003

Subject: How to determine if the row is visible? From: Vadim Date: October 11, 2003

I have a DIV and a long table inside it. DIV has vertical scroll bar for scrolling the table. And I use key handler for marking "current" row. I do it in this way

function handleKeyDown()
{
 var _o;

 if (event.keyCode == 38)
  {
   if (!_lastClicked){
    _o = gridBodyTable.rows[0];
    markRow(_o);
   }
   else{
    if (_lastClicked.previousSibling) {
     _o = _lastClicked.previousSibling;
     if ((_lastClicked)&&(_lastClicked != _o)) markRow(_o);
     _o.scrollIntoView(false);
    }
   }
  }
  
 if (event.keyCode == 40)
  {
   if (_lastClicked == null){
    _o = gridBodyTable.rows[gridBodyTable.rows.length];
    markRow(_o);
   }
   else{
    if (_lastClicked.nextSibling){
     _o = _lastClicked.nextSibling;
     if ((_lastClicked)&&(_lastClicked != _o)) markRow(_o);
     _o.scrollIntoView(false);
    }
   }
  }
  
 if (event.keyCode == 13){
  if (showRowDetails) showRowDetails();
 }
}

But I don't like it - because it scroll table even when the row is in visible part of the DIV

I need to determine if the row is in visible part of the DIV (in this case I needn't to call scrollIntoView) and I need to determine if the row is from above or from below visible part of the DIV to call scrollIntoView with "true" or "false" parameter

Thanks in advance

Vadim




Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX