kiran a

kiran a

  • NA
  • 20
  • 9.3k

How to bind JQuery Datatable with list inside a class.

Feb 16 2021 8:27 PM
Hi,
 
I am trying to bind multiple jquery datatable with single ajax call.  Below is code snippet. 
 
How do we bind jquery datable when list is inside class.
 
Ajax call will return  "ReportViewModel".  List which is required to bind datatable will inside this object.
 
example as below
  1. public class ReportViewModel  
  2. {  
  3. public List AList { getset; }  
  4. public List MList { getset; }  
  5. public List ACList { getset; }  
  6. }  
  7. public class ReportingDataViewModel  
  8. {  
  9. public string CN { getset; }  
  10. public string RUrl { getset; }  
  11. public string Status { getset; }  
  12. public string StartTime { getset; }  
  13. public string EndTime { getset; }  
  14. } 
how do i feed the data to datatable like data.Alist ??
 
$("#RolesTable").DataTable({
"processing": true, // for show progress bar
"serverSide": false, // for process server side
"filter": true, // this is for disable filter (search box)
"orderMulti": false, // for disable multiple column at once
"ajax": {
"url": "/Reports/GetReports",
"type": "POST",
"datatype": "json",
 
},
"columnDefs": [{
"targets": [0],
"visible": false,
"searchable": false
}],
 
please help.

Answers (3)