Table jumps up after data returned from the server

Table jumps up after data returned from the server

yishayhyishayh Posts: 108Questions: 17Answers: 0

Hi Allan,

We are using force.com as our server so we can't your server side plugins.
We wrote Api layer a directive wrapping datatable that manipulate the information to/from the server and we use serverSide=false in the datatable options.
Doing all of this we still have a case where the datatable jumps to the start as if rerendered.
The "jump" happens when this callback is fired:
_fnCallbackFire( oSettings, 'aoDrawCallback', 'draw', [oSettings] );

Please tell me if there is some information from oSettings that can help you direct us to our mistake.

P.S. We do have one table which works with out the jump.
Thanks,
Yishay

Replies

  • allanallan Posts: 61,880Questions: 1Answers: 10,138 Site admin

    What API method are you calling that triggers the "jump"? Are you drawing the table, or changing the data, or the paging, or something else?

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    1. The editor is opened and than on enter it calls editorAjax (the editor ajax option):
      function (method, url, data, successCallback, errorCallback)
    2. In the editorAjax we call the server and on return we call the successCallback with the information returned from the server.

    Thanks,
    Yishay

  • allanallan Posts: 61,880Questions: 1Answers: 10,138 Site admin

    So its Editor's draw that is causing the jump? You can use the drawType option of the form-options object to control the type of draw that Editor does when updating the table.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    thanks for the quick reply.
    I tried drawType: 'page' and drawType: 'none' and none of them helped me.
    Any other ideas as to what we're doing wrong?

    Thanks,
    Yishay

  • allanallan Posts: 61,880Questions: 1Answers: 10,138 Site admin

    Does the draw callback still get fires when you use drawType: 'none'? It shouldn't be!

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    it enters function _fnDraw( oSettings ) and than body.children().detach(); remove all the table and body.append( $(anRows) ); draws it again.

    Thanks,
    Yishay

  • allanallan Posts: 61,880Questions: 1Answers: 10,138 Site admin

    Sure - but my point is, what is causing it to go into that in the first please. I know how the internal mechanics work, but I need to know what is triggering that draw.

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    it is triggered in the following path:
    editorAjax -> successCallback (triggers the above functions)
    editorAjax is the ajax attribute passed in the editor options to new $.fn.dataTable.Editor

    Thanks,
    Yishay

  • allanallan Posts: 61,880Questions: 1Answers: 10,138 Site admin

    With drawType: 'none' it simply shouldn't be calling draw() though. This is the code from Editor:

            var drawType = this.s.editOpts.drawType;
            if ( drawType !== 'none' ) {
                dt.draw( drawType );
            }
    

    Perhaps it would be worth putting a debug line or a breakpoint at that point in the code and check that your drawType is being used correctly.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    I don't have such a line in our dataTable.editor.js, maybe this feature doesn't work in our version?
    Editor.version = "1.5.3";

    this is the callstack:
    (anonymous function) @ VM87428:1
    evaluate @ (program):113
    _fnDraw @ jquery.dataTables.js:2136
    _fnReDraw @ jquery.dataTables.js:2191
    (anonymous function) @ jquery.dataTables.js:7317
    iterator @ jquery.dataTables.js:6902
    (anonymous function) @ jquery.dataTables.js:7306
    (anonymous function) @ jquery.dataTables.js:7065
    commit @ dataTables.editor.js:5986
    Editor._dataSource @ dataTables.editor.js:4293
    (anonymous function) @ dataTables.editor.js:5101
    (anonymous function) @ datatable.js:1798
    processQueue @ angular.js:14991
    (anonymous function) @ angular.js:15007
    $eval @ angular.js:16251
    $digest @ angular.js:16069
    (anonymous function) @ angular.js:16290
    completeOutstandingRequest @ angular.js:5729
    (anonymous function) @ angular.js:6006

    Thanks,
    Yishay

  • allanallan Posts: 61,880Questions: 1Answers: 10,138 Site admin

    Editor.version = "1.5.3";

    That would do it. 1.5.6 is the current release.

    Allan

This discussion has been closed.