Can i use bServerSide true with dynamic columns without explicitly naming columns
Can i use bServerSide true with dynamic columns without explicitly naming columns
I am trying to achieve server side paging - so far am working on this below example:
[code]
$('#myDataTable').dataTable({
"bServerSide": true,
"sAjaxSource": "Page/AjaxHandler",
"bProcessing": true,
"aoColumns": [
{ "sName": "ID" },
{ "sName": "COMPANY_NAME" },
{ "sName": "ADDRESS" },
{ "sName": "TOWN" }
]
});
ID
Company name
Address
Town
[/code]
Can the above be changed where I DO NOT have to explicitly name each column - because in my server method/action it can return any number of columns and column names.
In my action I have the method "var allCompanies = DataRepository.GetCompanies();" where the GetCompanies is a sql datatable which I will output as JSON to the View.
[code]
$('#myDataTable').dataTable({
"bServerSide": true,
"sAjaxSource": "Page/AjaxHandler",
"bProcessing": true,
"aoColumns": [
{ "sName": "ID" },
{ "sName": "COMPANY_NAME" },
{ "sName": "ADDRESS" },
{ "sName": "TOWN" }
]
});
ID
Company name
Address
Town
[/code]
Can the above be changed where I DO NOT have to explicitly name each column - because in my server method/action it can return any number of columns and column names.
In my action I have the method "var allCompanies = DataRepository.GetCompanies();" where the GetCompanies is a sql datatable which I will output as JSON to the View.
This discussion has been closed.