How can I populate a dropdown for my editable DataTable?

How can I populate a dropdown for my editable DataTable?

savannakingsavannaking 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

  • allanallan Posts: 61,985Questions: 1Answers: 10,162 Site admin
    Answer ✓

    The table comes up and it looks like a dropdown but there are no items in the list

    Are you using Editor 1.4 beta? The options option was added in 1.4. In 1.3- it was called ipOpts.

    Thanks,
    Allan

  • savannakingsavannaking Posts: 7Questions: 3Answers: 0

    Yep, that works. Can't believe it was something so simple. Thank you!

This discussion has been closed.