Loading ...
Sorry, an error occurred while loading the content.

52176Re: Making sure a row that is selected is also visible

Expand Messages
  • Luke
    Nov 19, 2009
    • 0 Attachment
      There's no method baked into DT for that, but you can compare the scrollTop of the overflow container (easy enough to find in FireBug) with the offsetTop of the selected TR.

      HTH

      --- In ydn-javascript@yahoogroups.com, Christian Tiberg <ctiberg@...> wrote:
      >
      > Yes, thank you very much, but that's not the problem. I'd need a way to tell
      > whether I actually need to scroll the table, i.e. is the currently selected
      > row outside the visible area? Jumping the table every time a key is pressed
      > would look horrendous :( I'm looking for something like an isVisible method
      > for the datatable, but can't seem to find one.
      >
      > Best regards,
      > Christian Tiberg
      >
      >
      > 2009/11/18 Mauricio Ferreyra <mauriff@...>
      >
      > >
      > >
      > > Hi Christian ,
      > >
      > > You can use the method scrollTo from your ScrollingDataTable,
      > >
      > > Example:
      > >
      > > myDataTableY.subscribe("keypress", fnKey, myDataTableY, true);
      > >
      > > var fnKey= function(e,target){
      > > if(e.keyCode == 38 || e.keyCode == 40){
      > >
      > > myDataTableY.scrollTo(myDataTableY.getTrEl(e.target.sectionRowIndex));
      > > }
      > > }
      > >
      > > I think too you can use the event tableKeyEvent
      > > <http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#event_tableKeyEvent>
      > >
      > >
      > > Mauricio
      > >
      > >
      > >
      > >
      > > On Wed, Nov 18, 2009 at 9:10 AM, Christian Tiberg <ctiberg@...>wrote:
      > >
      > >>
      > >>
      > >> Hello!
      > >>
      > >> In a scrollable datatable wit "standard" selection, click the last visible
      > >> row, or move to it with the arrow keys. Then press down arrow once. The next
      > >> row is selected, but not visible. Bug or feature? Help needed, anyway - I'm
      > >> not sure how to do the math :)
      > >>
      > >> Best regards,
      > >> Christian Tiberg
      > >>
      > >
      > >
      > >
      >
    • Show all 4 messages in this topic