How to update row, after edit with a custom editor

How to update row, after edit with a custom editor

GeasLuGeasLu Posts: 12Questions: 3Answers: 0

Goodmorning at All,
I use datatables without Editor, because I need some other-complex input. How can i update the data after changing in my modal editor?

my datatables declaration is like this...

dtb =  $('#' + pIdDataTable).DataTable({
                        destroy: true,
                        responsive: true,
                        data : arrayFromAjax,
                        dataSrc : JsonData, 
                        selectType : "JsonDataArray",
                        columns: [
                            { // 0
                                data: "ID_OSPITE",
                                title : 'ID_OSPITE',
                                visible : false
                            },

and I use a modal form to input and edit data.

Is opssibile to update only the row that i have modified?

Thx to all

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923
    edited October 2020 Answer ✓

    Is opssibile to update only the row that i have modified?

    Use row().data() to update the row data. Use the appropriate row-selector to select the row.

    Kevin

  • GeasLuGeasLu Posts: 12Questions: 3Answers: 0

    Thank you Kevin!

    I do this:

    dtb.rows().every( function () {
                            var r = this.data();
                            if (r.ID == pId) {
                                console.log(r);
                                r.DATA_ORA_ULTIMI =  dToday;
                            }
                            this.invalidate();
                        }
                    )
                    dtb.draw();
    
This discussion has been closed.