Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82718

Select field with inline editor not submitting on change.

$
0
0

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?


Viewing all articles
Browse latest Browse all 82718

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>