Scroll to a certain index

Scroll to a certain index

robamacafrobamacaf Posts: 9Questions: 0Answers: 0
edited September 2011 in General
I am creating a table and having it open more details about the record using:
"fnDrawCallback": function() {
if (num && num != 0)
{
if ($('#'+num).get(0))
{
aData = $('#vm').dataTable().fnGetData( $('#'+num).get(0) );
$('#vm').dataTable().fnOpen( $('#'+num).get(0), fnFormatDetails($('#'+num).get(0), aData[3]), "faqdetails" );
var index = $('#vm').dataTable().fnGetPosition($('#'+num).get(0));
$('#vm').dataTable().fnUpdate("", index, 0, false);
//this.oScroller.fnScrollToRow( index );
num = 0;
}

And it works perfect. But now I want it to scroll to the one I just opened. Anyone have any idea on what to do here?

Thank you in advance!
Rob

Replies

  • robamacafrobamacaf Posts: 9Questions: 0Answers: 0
    I have been playing with this for almost 4 hours now and still can't figure it out. Any ideas?
  • allanallan Posts: 63,190Questions: 1Answers: 10,412 Site admin
    I see you are using Scroller - while there isn't a sliver bullet for your question (I hadn't expected this kind of interaction, I must admit, although it certainly makes sense - I'll look at adding in suitable methods), what you could do use use the jQuery $().position() method to get the position of the row in the scrolling element, then use fnPixelsToRow() and finally fnScrollToRow(). A bit messy I know - sorry about that. I'll try to get some time to tidy it up at some point.

    Allan
This discussion has been closed.