update row with editor inline

update row with editor inline

newDataTablernewDataTabler Posts: 2Questions: 1Answers: 0

Hi Guys

I am trying to follow and implement inline editing. Example:
https://editor.datatables.net/examples/inline-editing/simple.html

Problem I have (same the example has) no matter what I do, new value does not get saved.

May be pls just explain how to update the datatable row?

    var editor = new $.fn.dataTable.Editor({
      ajax: function (method, url, data, success, error) {
              var row = myTable.rows({ selected: true });

row.data(data_updated).draw() ...

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @newDataTabler ,

    I'm not clear what you mean by "Problem I have (same the example has) " - the example you have works fine for me, the changed data is being saved. I would suggest looking at your ajax, as you can see in the reference page, your usage isn't doing what's expected - it should be setting up the data submission. It's worth looking at the Ajax tabs on the example you mentioned, as it shows the expected client/server interaction.

    Cheers,

    Colin

  • newDataTablernewDataTabler Posts: 2Questions: 1Answers: 0

    I don't want to interact with the server. I am using ajax: just to handle "Submit" event..

    By example has the same problem, I mean the cell value does not get updated.
    It return the to the same value as previously.
    I can probably do it if on ajax I'll call server side, and then load all the data and then re draw() all the table, but I don't want to do it. It will create additional level of complexity because it is only one of the tables and update happens ones for all of them.
    Just want to update one cell in this table without interaction with the server..

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    If you don't want Editor to make an Ajax request to the server, don't supply the ajax option. That will cause Editor to just update the table locally, effectively treating the DataTable as the data store. There is an example of that here.

    Allan

This discussion has been closed.