Editor Datatables with variable Dropdownlist

Editor Datatables with variable Dropdownlist

tableFantableFan Posts: 7Questions: 5Answers: 0
edited August 20 in DataTables

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

  • colincolin Posts: 12,608Questions: 0Answers: 2,154

    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

  • tableFantableFan Posts: 7Questions: 5Answers: 0

    yes, I have licenses from another email

  • colincolin Posts: 12,608Questions: 0Answers: 2,154

    Excellent, thanks for letting me know. Please can you PM me the details of that email address, and I'll update our records.

    Colin

Sign In or Register to comment.