Scroll Up after using draw() function in angularJs

Scroll Up after using draw() function in angularJs

knetadminknetadmin Posts: 47Questions: 1Answers: 0

Thanks for replay i applied the part you motioned about :
setTimeout( function () {
DTInstances.getLast().then(function (dtInstance) {
dtInstance.DataTable.rows().invalidate().draw();
});
}, 0 );

But the new issue appeared after each update, scroll go to up always i am stop scroll down because of that i can see the end of datatables

Replies

  • allanallan Posts: 54,579Questions: 1Answers: 8,533 Site admin

    Hi,

    The draw() method, when called without any parameters will reset the paging / scrolling, which is what I think you are seeing in this case. Apologies, I should have thought of that when I wrote the above code!

    The fix is actually quite simple, just pass false to the draw() method.

                    setTimeout( function () {
                        DTInstances.getLast().then(function (dtInstance) {
                            dtInstance.DataTable.rows().invalidate().draw( false );
                        });
                    }, 0 );
    

    Regards,
    Allan

  • knetadminknetadmin Posts: 47Questions: 1Answers: 0

    Thank you very much for quick answer, it is working fine now

This discussion has been closed.