Question about Editor with server-side processing behavior

Question about Editor with server-side processing behavior

joeyfresh87joeyfresh87 Posts: 9Questions: 6Answers: 0

Hello,

I am enjoying using Datatables and Editor. In my latest project, I'm using the server-side processing option for the first time. I am using it in conjunction with Editor. I'm noticing that whenever the editor submits (and thus calls the URL I specified in the editor ajax), the URL in my datatable ajax is also called afterwards. So, that's two server-side URLs that are being called every time Editor submits -- first for the Editor, then for the Datatable. Is this always the case, by default, when you combine server-side and Editor? If so, why? Why can't I just call the first URL (Editor's URL), and it return the updated row -- why the need to also call Datatable's URL?

Is there a way to work around this and prevent the second URL from being called -- or is that inadvisable?

Thank you,
Joe

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,461Questions: 1Answers: 10,466 Site admin
    Answer ✓

    Hi Joe,

    You are right, this is not optimal, and its on my radar to address this. DataTables doesn't currently have an API method to allow a server-side processing table to redraw without an Ajax request, which is why this is an issue. You are absolutely correct that it would be better to have the SSP data come back with the edit request and for Editor to tell DataTables that this is what the next request data will be, but there is a bit of a loop there since DataTables has a draw counter that won't be incremented until the next draw...

    There is an option to tell DataTables to not redraw after an Editor action - that can be used to stop that second request. It is the drawType option of the form-options object. Setting it to none will cause the table not to redraw after an edit.

    Allan

  • joeyfresh87joeyfresh87 Posts: 9Questions: 6Answers: 0

    Thanks Allan! The drawType: "none" option worked perfectly for me. DataTables and Editor have so many great customizable options, I'm still not aware of them all!

This discussion has been closed.