How to scroll up in datatable pagination and stay there

How to scroll up in datatable pagination and stay there

Aditya14Aditya14 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

Answers

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    Please reply and help anyone it is urgent

  • kthorngrenkthorngren Posts: 21,301Questions: 26Answers: 4,946

    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

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0
  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    Please help anyone before 1 hr

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Does the scroll change occur due to the Ajax reload? It would be worth adding some debug.

  • kthorngrenkthorngren Posts: 21,301Questions: 26Answers: 4,946

    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

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    @Kevin But i have shared complete code but not working as per your link, what extra code is there ?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    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

  • Aditya14Aditya14 Posts: 27Questions: 5Answers: 0

    In simple language tell me what i need to do send

  • kthorngrenkthorngren Posts: 21,301Questions: 26Answers: 4,946

    Do one of two things:

    1. 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

    2. 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

  • rduncecbrduncecb Posts: 125Questions: 2Answers: 28

    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.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    @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

This discussion has been closed.