To try and make life easy, by default, DataTables will expect an array of arrays for its data source, with
an entry in each row's array for each cell. However, you may wish to have DataTables use an array of objects as
its data source (i.e. each row has its data described by an object). This can be done quite simply by using the
columns.data
option which tells DataTables which
property to use from the data source object.
In this example the Ajax source returns an array of objects, which DataTables uses to display the table.
Name | Age | Position | Office | Start date | Salary |
---|---|---|---|---|---|
Name | Age | Position | Office | Start date | Salary |