DataTable in bootstrap modal

DataTable in bootstrap modal

tomishtomish 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!

http://jsfiddle.net/tomrauch/8ennjt3t/4/

Answers

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    If you look in your browser's console you will see a Javascript error when you click the chart:

    $(...).dataTable is not a function

    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

  • tomishtomish Posts: 17Questions: 11Answers: 0

    Great, thanks - I will try that!

This discussion has been closed.