How to add rows when using Select and Expansion
How to add rows when using Select and Expansion
Hi,
We need to add a row to the DataTable which uses a select extension and also a expansion column.
When i try to add a row it does not let me add and gives me a error "Requesed Unknown Parameter" for the first column which is the select checkbox.
Below are the selection and expansion columnDef's
`this.selectionDef = {
orderable: false,
searchable: false,
className: 'select-checkbox',
targets: 0
};
this.expansionDef = {
className: 'control',
orderable: false,
defaultContent : '',
targets: 1
};
`
This is how we are loading the datatable
var table = $(tableIdCurrent).DataTable({
serverSide: getDataTableObject(tableIdCurrent).dtLoadingMethod,
sPaginationType: "full_numbers",
paging:true,
searching:false,
pageLength : getDataTableObject(tableIdCurrent).dtPageLength,
lengthMenu: getDataTableObject(tableIdCurrent).dtPageLengthOption,
columns: getDataTableObject(tableIdCurrent).columnDef,
order: [[ getDataTableObject(tableIdCurrent).defaultColumn, "asc" ]],
columnDefs: [ getDataTableObject(tableIdCurrent).selectionDef,
getDataTableObject(tableIdCurrent).expansionDef,
getDataTableObject(tableIdCurrent).orderDef
],
select: getDataTableObject(tableIdCurrent).selectionModeDef,
rowId: getDataTableObject(tableIdCurrent).rowid,
ajax: {
url:getDataTableObject(tableIdCurrent).dtURL,
type: "POST",
data:function(d) {
var table = $(tableIdCurrent).DataTable()
d.page = (table != undefined)?table.page.info().page:0
d.size = (table != undefined)?table.page.info().length:5
d.sort = d.columns[d.order[0].column].data + ',' + d.order[0].dir
d.search = getDataTableObject(tableIdCurrent).searchVal
d.searchCol = getDataTableObject(tableIdCurrent).searchCol
}
},
bRetrieve: true
});