OneTwo
OneTwo

Reputation: 2483

How to have a dropdown box in a jquery datatable which uses an ajax call to retrieve the data

I want to have a dropdown box in one of the columns of my datatable. Like in this example. But my table sources it's data through an ajax call which gets the data from the server. This means that I can't just put a option group inside a td. What is the easiest way of doing this?

Upvotes: 2

Views: 4572

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58880

SOLUTION

You can use columns.defaultContent if content (your dropdown box) doesn't depend on row's data, or columns.render for content that depends on row's data.

DEMO

See Generated content for a column example for demonstration of columns.defaultContent option usage.

Upvotes: 2

Related Questions