is there a way to set the focus to a particular row in a datatable regardless of what page it is on?

is there a way to set the focus to a particular row in a datatable regardless of what page it is on?

dfbiiidfbiii Posts: 1Questions: 1Answers: 0

HI,
I have a datatable that I populate rows using fnAddData and assign it the ID of the data using fnGetNodes- When I click on each row - I put that rows data into an updatable form. When data is changed, I re-populate the datatable to ensure the data in the table is current but this sets the focus to the first page. I'd like to set the focus to the page which contains the row that was just edited. Since each row has been assigned an ID - I tried the following

$('#myTable body #' + theID).focus(); where theID is equal to the ID I set to the row

but does not do the job.

Thanks
Dave

Answers

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    You would need to use fnPageChange (legacy - page() is the 1.10+ method) to change the page to where the data is.

    With the currently API you could use this plug-in to jump the paging to a particular row. Perhaps a row().display() plug-in would be even more useful allowing a row selector to be used.

    For legacy versions you could try this plug-in but I have no idea if it will work with the current 1.10.12 release...

    Allan

This discussion has been closed.