Behavior of Datatables after updating

Behavior of Datatables after updating

masaishimasaishi Posts: 6Questions: 0Answers: 0
edited May 2012 in General
Hi Guys,

I am facing a non-desirable behavior from DataTables after I update a value - after I submit the data, the whole page is refreshed. This doesn't happen when I add or delete a record. Actually, I think the page is not reloaded but is called again like I was loading it for the first time. I lost the filters and the sorting.

I didn't find out any parameter that I should set to prevent this behavior. I would like that the post update action works like the post add or remove rows - just refresh the datatables itself.

Any ideas?

Thank you

Replies

  • allanallan Posts: 63,204Questions: 1Answers: 10,415 Site admin
    My guess is that there is a Javascript error which is stopping the 'submit' event from running the preventDefault operation. What does Firebug say?

    Allan
  • masaishimasaishi Posts: 6Questions: 0Answers: 0
    Good question. But I realized something: It works on Firefox (don't call the page again), but didn't work on Chrome (that was my development browser).
  • allanallan Posts: 63,204Questions: 1Answers: 10,415 Site admin
    So in that case, what does Inspector say? :-)

    Allan
  • masaishimasaishi Posts: 6Questions: 0Answers: 0
    Nothing... Console is clean even after the whole action. I guess there is a GET or POST request being lost, because the URL after the update is modified. Before the updating, the URL is localhost/Page and, after, the URL is localhost/Page?value=NewValue
  • masaishimasaishi Posts: 6Questions: 0Answers: 0
    Hi,

    I looked into the problem a little more and decided to compare the behavior of the updating in Chrome, IE and Firefox.

    The bad news is that it works perfectly in IE and Firefox :-).

    I tested editing a row value and leave the cell clicking on another local of the page. What I realized is that there are two calls to jQuery.event.dispatch. In IE and FF, the first event that calls dispatch is 'blur' and then 'submit'. In chrome, the opposite is done. I don't know if this could cause a different reaction in DataTables...
  • masaishimasaishi Posts: 6Questions: 0Answers: 0
    Update:

    This post solved the problem when I leave the cell:

    http://www.datatables.net/forums/discussion/4470/pagination-is-reset-when-using-a-jeditable/p1

    But I still have the problem when I press ... Probably, should I configure something during the aoColumn configuration? There I only used onblur: 'submit'.
  • masaishimasaishi Posts: 6Questions: 0Answers: 0
    Things getting funny.....

    So, I disabled the submit action after blur and finish edition with ENTER started working perfectly. But I would like to keep both options - finish updating pressing ENTER or leaving the cell.... Any ideas?
  • allanallan Posts: 63,204Questions: 1Answers: 10,415 Site admin
    Not really I'm afraid. Are you certain that preventDefault is being called when the enter key is being pressed? I'd suggest adding debug to make sure that is the case.

    Allan
This discussion has been closed.