How can I populate a dropdown for my editable DataTable?
How can I populate a dropdown for my editable DataTable?
 savannaking            
            
                Posts: 7Questions: 3Answers: 0
savannaking            
            
                Posts: 7Questions: 3Answers: 0            
            I'm doing this:
   editor = new $.fn.dataTable.Editor({
        ajax: 'url',
        table: '#invDetailsTable',
        fields: [{
            label: "Location",
            name: "location",
            type: "select",
            options: locationList
        }]
    });
locationList is just an array of objects with {label: 'name', value: 0} as the objects. The table comes up and it looks like a dropdown but there are no items in the list. Is there something else I need to do to populate the dropdown? This is all I found in the documentation... I tried it with a list I feed directly to the fields parameter like this:
            options: [
                { label: "To do", value: 0 },
                { label: "Done",  value: 1 }
            ],
but had the same result.
Any ideas would be much appreciated!
This question has an accepted answers - jump to answer
Answers
Are you using Editor 1.4 beta? The
optionsoption was added in 1.4. In 1.3- it was calledipOpts.Thanks,
Allan
Yep, that works. Can't believe it was something so simple. Thank you!