Prevent reload data from server after submitSuccess

Prevent reload data from server after submitSuccess

webeetlewebeetle Posts: 3Questions: 1Answers: 0
edited January 2016 in Editor

There's a way to prevent the whole ajax page reload after successSubmit event? I'm using datatableEditor on a datatable with these options:

processing: true
serverSide: true

I'm using inline excel editor and when I press Enter or Tab button the submit is processed but on success the entire page data is reloaded, losing next cell focus!

Thanks

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    If you are using serverSide then unfortunately no. When Editor updates the data it will trigger a draw() call which, when using server-side processing, will always make an Ajax request to get the latest data.

    KeyTable and Editor should actually play nicely when used with server-side processing. Could you try using the KeyTable nightly and there are also a few changed in Editor which are as yet unreleased related to possible timing errors here. Can I e-mail you at the address your account is registered with, with the latest dev version of Editor which addresses this issue?

    Thanks,
    Allan

  • webeetlewebeetle Posts: 3Questions: 1Answers: 0

    Of course Allan I'll be grateful! Is there a way to stop draw event propagation?

    Thanks

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    How do you mean - stop it from bubbling up the DOM structure?

    Allan

  • webeetlewebeetle Posts: 3Questions: 1Answers: 0

    No, I asked if there's a way to stop draw call event propagation after submitSuccess! Is there a way to change the source code to prevent it?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I'm afraid I still don't quite understand (I think its the "event propagation" term that is confusing me in this context - you want to have the draw method not be called? The draw() call happens before submitSuccess, so that event can have no effect on the draw.

    If I've understood correctly, then there isn't a way to do that in the current release of Editor I'm afraid. However, in the Editor source if you look for:

    dt.draw( this.s.editOpts.drawType );
    

    and replace with:

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

    Then you can use the drawType option of form-options set to be none and the redraw will not happen. The downside is that the updated data will not be sorted or filtered correctly (for that a redraw is required).

    Allan

  • NovossNovoss Posts: 1Questions: 0Answers: 0

    For anyone who finds this, Allan's solution is included in Editor 1.5.6. It may have been included in earlier versions. To use the drawType option:

    var editor = new jQuery.fn.dataTable.Editor( {
        ...
         formOptions: {
            inline: {
                drawType: "none"
            }
        }
        ...
    });
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    The none option was included in 1.5.5+. Full documentation for the form options is available in the form-options reference.

    Regards,
    Allan

This discussion has been closed.