DataTable in bootstrap modal
DataTable in bootstrap modal
tomish
Posts: 17Questions: 11Answers: 0
Hi, I am new to working with dataTables. I would like to create a click feature on a flot chart that pops up a modal with data in it. Right now, I am just trying to get some sample data to load (not the actual data that renders the chart - that will come later).
Here's my jsfiddle. As you can see, when you click on a chart element (bar, line), the modal appears but should load the sample data (name, position, office, etc.) but the dataTable is empty.
Thanks for your help!
This discussion has been closed.
Answers
If you look in your browser's console you will see a Javascript error when you click the chart:
Looks like DataTables has not been included.
Adding the Javascript file to the page allows the page to render, but you are feeding it a arrays of data for each row and yet telling it to expect objects (through the use of
columns.data
).Removing that configuration, so it expects an array, allows it to work.
If you want object, you need to use objects in the data!
Allan
Great, thanks - I will try that!