Hello. I have a DataTable that is returning BD values, however I need only one column to always have fixed values that will not come from the DB (in this case, it is a column with the months of the year). However, I can not change the structure of the DataTable directly in HTML because I'm building it as follows:
var colsBaseLT = [
{ data: null, className: 'col-sm-2 text-center', title: 'Base Hour', defaultContent: ''},
{ data: 'Quantity', className: 'col-sm-2 text-center', title: 'Quantidade', defaultContent: ''},
{ data: 'Year', className: 'col-sm-2 text-center', title: 'Ano', defaultContent: ''},
];
function CreateTable() {
DataTablesAjaxPagination("#tableBaseHour", colsBaseLT, null, null, 12, 'BaseHour');
$.ajax({
url: urlCreateTable,
type: 'POST',
success: function (result) {
dataTableBH = DataTablesAjaxScrollHeight('#tableBaseHour', colsBaseLT, result.Grid, null, "350px");
}
});
}
In the first column, the Base Hour, I want there to be 12 pre-defined lines with the months of the year in each. I have already tried using table.row.add
, but since DataTable is initializing by the Pagination method I ended up not being able to have the lines created with the values I put.
Could anyone help me with this?
EDIT: I was able to make the DataTable show the list of Months, but it shows the entire list in a single field! How do I make each month appear in a field on a different line?