Editor Modal Doesn't Open after fnAjaxReload

Editor Modal Doesn't Open after fnAjaxReload

mdturnermdturner Posts: 3Questions: 0Answers: 0
edited September 2013 in Editor
Hi,

I'm experiencing some issues getting the editor modals to play nice when using the fnAjaxReload extension. I'm having to the use the fnAjaxReload extension because there is no server-side code backing my page, even though it is written in JSP. I'm using only ajax calls to a REST endpoint I control to fetch all my data for the page, thus setting bServerSide and bProcessing to true has no effect. When I make create, edit or delete a row I use the extension to force the table to update without having to refresh the entire page. Unfortunately doing this seems to have the knock on effect of breaking the create, edit and remove modals. Is there some other magic step I'm missing to reset those modals?

Thanks in advance!


My basic setup uses the following scripts in order:

jquery.dataTables.min.js
dataTables.tableTools.js
dataTables.editor.min.js
dataTables.bootstrap.js
dataTables.editor.bootstrap.js
dataTables.fnReloadAjax.js
jquery.dataTables.css
dataTables.bootstrap.css

the setup for my editor is given below

subjectGroupEditor = new $.fn.dataTable.Editor( {
"ajaxUrl": {
"create": "${pageContext.request.contextPath}/rest/study/" + <%= request.getParameter("id") %> + "/subjectgroup/save",
"edit": "${pageContext.request.contextPath}/rest/study/" + <%= request.getParameter("id") %> + "/subjectgroup/save",
"remove": "${pageContext.request.contextPath}/rest/study/" + <%= request.getParameter("id") %> + "/subjectgroup/"
},
"ajax": function ( method, url, data, successCallback, errorCallback ) {

if(data.action == "remove")
{
for (var i=0; i

Replies

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    I don't actually see where you are attaching events, but it sounds very much like this: http://datatables.net/faqs#events .

    I don't have a record of your Editor license. Could you confirm for me which DataTables account you are using the license from or as a trial, so I can keep my records up-to-date and direct support as appropriate?

    Thanks,
    Allan
  • mdturnermdturner Posts: 3Questions: 0Answers: 0
    Hi Allan,

    I'm on the trial at the moment just assessing if it fits the needs of the project I'm working on. We're actually a research project in a university, is there a licence that covers research projects or is it commercial stuff only?

    In terms of the issue above, it does sound like the description in the link you provided. I'm not attaching any custom events I'm just using the standard editor setup, the events that don't work second time around are the create, edit and remove buttons in the editor toolbar that gets placed above the table. Is there a way I can trigger some kind of rebind? Or perhaps you can think of another way of refreshing my table after a CRUD operation without using fnAjaxReload.

    Thanks,

    Mark
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    > is there a licence that covers research projects or is it commercial stuff only?

    Thanks for the explanation - If its non-profit, then absolutely there is a discount available. Drop me a line via e-mail allan @ this domain and I'll set it up with you.

    When you say "the second time" - what is actually happening? Are you destroying the old table and creating a new one, but with the same Editor instance, or are you simply calling fnReloadAjax on the existing table and then the Editor buttons no longer work (that shouldn't be the case - they should work fine in that setup!).

    Allan
  • mdturnermdturner Posts: 3Questions: 0Answers: 0
    Basically the current flow is that the page loads without error, I can click on any of the editor buttons and the modal appears. Let's say I've edited an existing row and hit save, the changes are saved via an AJAX call and I then call fnReloadAjax to update the UI and my changes appear in the table, the modal then closes and everything is then fine. If I then hit any of the editor buttons again nothing happens, I can't get any modals to appear but there are no javascript errors in firebug, it's like the buttons have lost their event handlers.
This discussion has been closed.