JavaScript (arrays/objects)

At times you will wish to be able to create a table from dynamic information passed directly to DataTables, rather than having it read from the document. This is achieved using the data option in the initialization object, passing in an array of data to be used (like all other DataTables handled data, this can be arrays or objects using the data option).

jQuery DataTables Checkboxes extension requires that column containing checkboxes had unique data.

Table is initialized using the data shown below. Data is supplied as a value for data option. For simplicity, each element of the array corresponds to the appropriate column in the table. First element of the array holds the data for the column containing checkboxes and is unique (1, 2, 3, etc.).

{
  "data": [
    [
      "1",
      "Tiger Nixon",
      "System Architect",
      "Edinburgh",
      "5421",
      "2011/04/25",
      "$320,800"
    ],
    [
      "2",
      "Garrett Winters",
      "Accountant",
      "Tokyo",
      "8422",
      "2011/07/25",
      "$170,750"
    ],
    [
      "3",
      "Ashton Cox",
      "Junior Technical Author",
      "San Francisco",
      "1562",
      "2009/01/12",
      "$86,000"
    ],
    ...
}

Example using array of arrays

Example using array of objects