Update select options, losing the field when submit
Update select options, losing the field when submit
HI,
I need to add assistant, update the options of the select with a list of all assistant available dynamically,
I'm building the editor, calling in ajax the list of assistant, and updating select options after create the editor.
All work except when i'm submit informations, i'm loosing the Staff information in POST element send.
Can you help me to understand ?
$('#assitant').on( 'click', function (e) {
e.preventDefault();
var options = [];
$.ajax({
...
success: function (json) {
options = JSON.parse(json);
editor
.create(
"New assistant",
{ "label": "New assistant", "fn": function () { editor.submit() } }
)
.field('staff').update(options);
}
});
});
editor = new $.fn.dataTable.Editor( {
ajax: 'staff.php',
fields: [
...
{
label: "Assistant",
name: "staff",
type:"select",
options: []
},
...
]
});
}
Regards,
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Ok I found, i forgot the staff field in my EDITOR:inst.
Now that's work well.
Thanks
Thanks for posting back - good to hear you have it working!
Allan