How to scroll up in datatable pagination and stay there
How to scroll up in datatable pagination and stay there
Aditya14
Posts: 27Questions: 5Answers: 0
Hi, I have one datatable pagination i have applied following query to scroll up it is going up but after few seconds again coming down
dt.on('page.dt', function () {
$('html, body').animate({
scrollTop: $(".dataTables_wrapper").offset().top
}, 'fast');
});
this query i m using for scrolling once click on pagination it is going up but again coming down moreover not going complete up some margin left from above in scroll bar
This discussion has been closed.
Answers
Please reply and help anyone it is urgent
Can you post a link to your page or a test case showing the issue?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Maybe you have something running at timed intervals that is causing Datatables to redraw,
ajax.reload()
for example?Kevin
http://live.datatables.net/jotexemo/2/edit
Here is the code
Please help anyone before 1 hr
Does the scroll change occur due to the Ajax reload? It would be worth adding some debug.
I started a test case for you:
http://live.datatables.net/yijikusa/1/edit
It seems to work with a basic config of server side processing, ajax.reload() and your event to scroll to the top.
Please add to the test case to replicate your issue.
Kevin
@Kevin But i have shared complete code but not working as per your link, what extra code is there ?
Hi Aditya,
Working code would be the most helpful. Kevin has very generously started that for you in his last mail, but as he said, we're unable to reproduce the problem.
Bear in mind that DataTables is a mature product, so is very stable - when oddities do occur the best way to get quick help is to provide live examples so that we're able to see what the various interactions are.
Thanks,
Colin
In simple language tell me what i need to do send
Do one of two things:
Provide a link to your page showing the issue or build an example that shows the issue:
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Slowly add and test your code to the example I provided until you spot the issue
In order to help troubleshoot we will need to see running code that is exhibiting the issue.
Kevin
From one of your previous posts that I assisted with I believe you are reloading the table and retaining the page. I suspect your reload is causing the page scroll to reset. Try stopping the periodic reload and see if it makes a difference, if it does then you know the cause. However, as the previous posts explain, without seeing the code and having a test case there's not much anyone can practically do.
@Aditya14 - The forum rules clearly request that you be polite and when asking for support you post test cases. You have not posted test cases, which have been requested by a number of members of the community in this thread and a number of your posts have not been, what I would term, polite.
If you require urgent help with your issue, there are a number of priority support packages available.
If you require further help, please follow the forum rules.
Regards,
Allan