No data saved onBlur after update 1.5.0 (inline edit)

No data saved onBlur after update 1.5.0 (inline edit)

helge.suesshelge.suess Posts: 1Questions: 1Answers: 0
edited August 2015 in Editor

Hi, I updated from Editor 1.4.2 to 1.5.0.

I have a grid where only one column can be edited, the column type is select (3 status values). After the first try, it throw an error: dataTables.editor.js: 4990: Uncaught TypeError: Cannot read property 'length' of undefined
After some research I found out that with verison 1.5.0 the multi-row edit feature was added. Therefore the ajax data template changed and so on.
I added the property legacyAjax: true, the error wasn't thrown anymore, but neither was the ajax url called and therefore the data wasn't updated.

Is this a bug or did I overlook something ?

my code snipped:

// editor init
 var editor = new $.fn.dataTable.Editor({
        ajax: "/api/postdata",
        legacyAjax: false,
        table: "#overviewTable",
        processing: true,
        fields: [
            {
                label: "Id",
                name: "Id"
            },
            {
                label: "Status",
                name: "Status",
                type: "select",
                options: [
                    { label: "new", value: 0 },
                    { label: "mid", value: 1 },
                    { label: "old", value: 2 }
                ]
            }
        ]
    });

// table init
    var table = $('#overviewTable').DataTable({
        dom: "Tfrtip",
        ajax: "/api/getdata",
        select: {
            style: 'os',
            selector: 'td:first-child'
        },      
            columns: [
                { data: "Id", className: "readOnly", visible: false },
                {
                  data: "Status",

                    fnCreatedCell: function(nTd, sData, oData, irow, iCol) {
                        jQuery.each(editor.field(editor.fields()[1]).s.opts.options, function(index, option) {
                            if (option.value === sData) {
                                $(nTd).html(option.label);
                            }
                        });
                    },
                    mRender: function(data, type, full) {
                        for (var i = 0; i < editor.field(editor.fields()[1]).s.opts.options.length; i++) {
                            if (editor.field(editor.fields()[1]).s.opts.options[i].value.toString() === data) {
                                return editor.field(editor.fields()[1]).s.opts.options[i].label;
                            }
                        }
                        return data;
                    }
                },
                { data: null, className: "action readOnly", defaultContent: '<a href="#">Info</a>' }
            ],
            order: [1, 'asc'],
            tableTools: {
                sRowSelect: "os",
                sRowSelector: 'td:first-child',
                aButtons: []
            }
        });

    // data reload every 30 seconds
    setInterval(function () {
        table.ajax.reload(null, false);
    }, 30000);

    // Inline Edit - only those who are not readOnly
    $('#overviewTable').on('click', 'tbody td:not(:first-child .readOnly)', function (e) {
        editor.inline(this, {
            submitOnBlur: true
        });
    });

This discussion has been closed.