Scroll position reset to first record caused by 3rd draw after edit submit

Scroll position reset to first record caused by 3rd draw after edit submit

mpcleverdonmpcleverdon Posts: 19Questions: 2Answers: 0

Hi All

I am using DataTables with editor, ajax,serverSide:true, scroller:true and inline editing, which works very fast for a 10,000+ record table.

My problem is that when submiting a change there are three calls made:

  • First JSON response correctly replies with the modified row:
{"data":[{"DT_RowId":"row_4210","prodn":{"fecha":"30-10-13","excode":"SC4","agcode":"THA","gucode":"54C"
,"prodno":"91310051","horas":"10","langs":"1","paxadult":"59","paxchild":"0","pax":"59","bono":"","idiomas"
:"A"}}]}
  • The second ajax call is the redraw information positioned correctly to view the modified row:
{"data":[{"DT_RowId":"row_4330","......  {"DT_RowId":"row_4210","prodn":{"fecha":"30-10-13","excode"
:"SC4","agcode":"THA","gucode":"54C","prodno":"91310051","horas":"10","langs":"1","paxadult":"59","paxchild"
:"0","pax":"59","bono":"","idiomas":"A"}},........

Great!... but then DataTables does a complete redraw and scrolls to the begginning of the table.

Apart from filtering to the requiered row which can be very time consuming and not all users fully understand I have tried the following.

        editor.on('submitComplete', function(e,json,data) {
            var t=parseInt( data['DT_RowId'].replace(/row_/g, '') );
            if (t !=0 ) table.row(t).scrollTo();
        });

But this also happens before the DataTables refresh.

How do I stop DataTables doing the third ajax call?

I dont have an example online yet as it is all on my laptop, but I did see on the forum a post that shows a modification in scroller

But in scroller 1.4.2 the code to be replaced is not the same and I would prefer not to customize the library

DataTables debug link http://debug.datatables.net/ilijor

Thanks for all the hard work on the fantastic project.

Regards Mark

This discussion has been closed.