What is the max limit of columns that can be binded in a datatable?
What is the max limit of columns that can be binded in a datatable?
I am able to bind less than 23 cols successfully but i go beyond that, no data is displayed.
Below code is working properly in case of less than 23 cols.
How to bind if there are more than 23 cols?
View:
Action | Case Id | ....30 cols
---|
JS:
var aryColTableChecked = ["col1 ","col2"..."col30"];//30 columns
var aryJSONColTable = [];
for (var i = 0; i < aryColTableChecked.length; i++) {
aryJSONColTable.push({
"sTitle": aryColTableChecked[i],
"aTargets": [i]
});
};
var Table = $('#TableXYZ').dataTable({
"sScrollY": "auto",
"bJQueryUI": true,
"bServerSide": true,
"sAjaxSource": "actionName",
"bProcessing": true,
"pagingType": "full_numbers",
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "paramName", "value": paramValue});
$.getJSON(sSource, aoData, function (json) {
fnCallback(json)
});
},
"aoColumnDefs": aryJSONColTable
});
Controller:
//this is working properly
public ActionResult actionName(DataTableParamModel param)
{
List<EmployeeDataModel> employeeList = GetEmployeeData();
var employeeData = (from list in employeeList .Skip(param.iDisplayStart).Take(param.iDisplayLength)
select new[] { "list.id,list.name,list.addres.....n});
return Json(new
{
sEcho = param.sEcho,
iTotalRecords = employeeList .Count,
iTotalDisplayRecords = (employeeData ).ToList().Count,
aaData = employeeData
}, JsonRequestBehavior.AllowGet);
}