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: 61,972Questions: 1Answers: 10,160 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.