Select , scroll to specific row programmatically

Select , scroll to specific row programmatically

hawkmasterhawkmaster Posts: 56Questions: 20Answers: 0

Hello
I try to select and mark a row of a table programmatically.
I found this old post where someone made a function goToRow.

http://datatables.net/forums/discussion/11574/how-do-i-go-to-scroll-to-row-without-using-scroller-plug-in

But I have problems with jQuery('#DataTablesDIV .dataTables_scrollBody')[0].scrollHeigh
I cannot find a ID DataTablesDIV inside my HTML code.
Was there a change?

            if(kdID != ''){
              $('#myTable tr').each(function(i) {
                  var id = $(this).find("td").eq(0).html();
                  if(id == kdID){
                      alert('found ' + i + '-' + kdID);
                      $("#myTable tbody tr").eq(i).addClass('row_selected');
                      //goToRow(i, oProjectTable)
                      return false;
                  }
                  i+1;    
              });

Is there another way to scroll to a row in a table with a given columns (unique) value?

best regards
Hans

Answers

  • hawkmasterhawkmaster Posts: 56Questions: 20Answers: 0

    Nobody an idea how can do this?

  • WoldereWoldere Posts: 17Questions: 3Answers: 2
    edited December 2014

    Isn't that just the id of the div where the datatable is in? Like a div you make and name yourself?

  • hawkmasterhawkmaster Posts: 56Questions: 20Answers: 0

    Perhaps my description was wrong.
    Example:
    Data table was filled from Db with 100 records. Column 1 is "rowid"
    I have a scrollable table so you can see about 10 records at once.
    A user fill in a textfield number "1234", klick enter.
    Then the datatable content should scroll to the row where column 1 = 1234

This discussion has been closed.