Select field with inline editor not submitting on change.

Select field with inline editor not submitting on change.

IsaacBenIsaacBen Posts: 35Questions: 8Answers: 4

Here is how I define the fields

fields: [
    { label: 'Name', name: 'name' },
    { label: 'Email', name: 'email' },
    { label: 'Role', name: 'role', type: 'select',
        options: [
            { label: "Viewer", value: "Viewer" },
            { label: "Administrator", value: "Administrator" }
        ]
    },
]

When the user changes selection it doesn't do anything.
I'm using this as a work around, which is fine, but would like to see if there is something better.

var index = 1;
$(".page-content").on("change", "#DTE_Field_role", function() {
    console.log("what")
    if(index == 1) {
        index++;
        return;
    }
    var role = $(this).val();
    editor.submit();
    index = 1; //Back to what it was
});

The change listener is being called when the input field is first appended so I have to use an index variable so it won't submit right away.
Why is it being called if the user didn't select anything yet?

This question has an accepted answers - jump to answer

Answers

  • PaulusPaulus Posts: 69Questions: 17Answers: 5
    Answer ✓

    This works for me for select options in inline editing, my first column is index.

                var formTable = $('#SampleTable', form);
                formTable.on('click', 'tbody td:not(:first-child)', function (e) {
                    editor.inline(this, {
                        onBlur: 'submit',
                        submit: 'allIfChanged'
                    });
                });
    
  • IsaacBenIsaacBen Posts: 35Questions: 8Answers: 4

    Thank you!

This discussion has been closed.