Editor still submits data when disabled

Editor still submits data when disabled

tdktdk Posts: 32Questions: 16Answers: 0

I am using the editor inline and disabling the editor if the user doesn't have edit permissions however, although the field is disabled if the user clicks into it then clicks away the form submits. I have turned on onBlur submit but i would have thought this should not happen if the editor is disabled.

 editor = new $.fn.dataTable.Editor({
        ajax: { ... },
        table: "#table",
        idSrc: "Id",
        fields: [...        ],
        formOptions: { inline: { onBlur: "submit", submit: "all" } }
    });

    editor.on("preSubmit", function(e, d, action) {
        $.each(d.data, function(key, vals) { $.extend(d, vals); });
        delete d.data;
        d = JSON.stringify(d);
    });
    
    $("#table").on("key-focus", function(e, datatable, cell) {
        editor.inline(cell.index());
    });

Answers

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    There is no option to disable Editor as a whole, only individual fields. And even when a field is disabled, yes, its value still exists so it would be submitted.

    A better option would be if the user doesn't have editing permissions to not even show them the edit button.

    Allan

  • tdktdk Posts: 32Questions: 16Answers: 0

    Hi Allan, There is now edit button as it's inline.

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    Even better then - don't allow the click to inline edit if they don't have permission to edit!

    Allan

This discussion has been closed.