How to scroll down to previous td tr after ajax success without scroller extension
How to scroll down to previous td tr after ajax success without scroller extension

Hi,
I can't use the scroller extension because I don't use the pagination and I can't use 'no warp'.
My table has the 'FixedHeader' extension.
After successfully updating data using Ajax, the table always goes back to the first row.
I want to remember the current <tr> before clicking a button, 'Update', then after ajax call, I want to scroll to the <tr> for users.
Otherwise users have to scroll down to find where they were and the table is long so this is not user friendly.
How can I achieve this?
I used 'complete' function like below, but it is not working. The table shows the first row.
function update(jsonDataString,position){
var trClass = position; //this is table row's class
var cP = '.' + trClass;
$.ajax({
url:myurl,
method:"POST",
data:{},
success:function(response){
if(response.success == true){
fetch_data();//update records. This is another ajax function.
}
},
complete:function(response){
$("html,body").animate({
scrollTop: $(cP).offset().top
}, 2000 );
}
});
Thanks.
Answers
Hi @silver2018 ,
This SO thread should help, it's asking the same thing.
Cheers,
Colin