Editor Datatables with variable Dropdownlist
Editor Datatables with variable Dropdownlist
tableFan
Posts: 10Questions: 7Answers: 0
Hello I have an editor table and would like to design one column as a variable dropdown. The values for the dropdown come from the ControllerDrpDwn method implemented in the controller.
How can i get this output as dropdown options?
editor = new $.fn.dataTable.Editor({
ajax: { url: "/Controller/EditorTable" , type: "POST"},
table: "#tbl",
fields: [{
label: "abc:",
name: "abc"
},{
label: "xyz:",
name: "xyz",
type: "select"
// option: Output from ControllerDrpDwn method
}]
});
this is the method:
public async Task<IActionResult> ControllerDrpDwn()
{
return Ok(await _context.Dropdownoptions.Where(x => x.Selectbezeichnung == "xyz").Select(x => new
{
name = x.Optionbezeichnung
}).ToListAsync());
}
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
I see you're using Editor in your example, but our accounts aren't showing that you have a license. Is the license registered to another email address? Please can let us know so we can update our records and provide support.
Thanks,
Colin
yes, I have licenses from another email
Excellent, thanks for letting me know. Please can you PM me the details of that email address, and I'll update our records.
Colin