Select row after ScrollToRow
Select row after ScrollToRow
nightop
Posts: 4Questions: 0Answers: 0
Hi!
Thank you very much for your excellent grid!!!
I have a problem: I can't select row after scroller().scrollToRow.. (server-side)
I have found a similar question, but there is no decision there:(
Help plz!
This discussion has been closed.
Replies
The previous discussion does have a solution using the
draw
event. The trick is figuring out how you are going to track the row to select. I put together this example based on the Server-side processing (5,000,000 rows) example:http://live.datatables.net/nivizera/1/edit
Its a brute force example that tracks the row (either '0' or '5000'). Click the "Goto 5000" button and row 5000 will be shown and highlighted.
In the
table.on( 'draw', function () {...})
function you will need to determine if you want to select the row each time the table is drawn. In the example I only select the row if the "Goto" button is clicked. You will also need to decide how to determine which row to highlight. I simply use a function to return the row that has5000-1
in column 0. Your case will be different using therow()
selector and modifier parameters.Kevin
Super! It works!
Thanks!!!
but how i can select row number 5002 after selecting 5000 , for example?
in this example 'draw' dosnt work
http://live.datatables.net/nivizera/3/edit
select 5000 -> deselect 5000 -> select 5002
Hi nightop,
The problem is that the draw only occurs when the data is loaded, the little nudge between 5000 and 5002 won't cause a redraw since it's within the buffering window.
There doesn't appear to be a scroll event that you could listen for - there's been some chat on it, but I don't believe it's been implemented yet.
Take a look at this thread from @squaregoldfish, he appeared to have the same problem and found a fix, though it looks more like a workaround than a solution.
Hope that helps,
Cheers,
Colin