Specify Column Data via HTML data attributes?

Specify Column Data via HTML data attributes?

jasper502jasper502 Posts: 25Questions: 9Answers: 0

In my initiailzation I have columns defined to match my AJAX JSON data as follows (example):

    columns: [
      { data: "column1" },
      { data: "column2" },
      { data: "column3" }
      ]

Is there a way to avoid this and define this from the view via html data attributes like this?:

          <table id="my_datatable" data-source="my_data.json">
            <thead>
              <tr>
                <th data-column="column1">Column 1</th>
                <th data-column="column2">Column 2</th>
                <th data-column="column3">Column 3</th>
              </tr>
            </thead>
            <tbody>
            </tbody>
          </table>

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.