Gcobani Mkontwana

Gcobani Mkontwana

  • 1.2k
  • 690
  • 22.7k

Dropdownlist is not working on my DataTable?

Feb 17 2020 7:30 AM
Hi Mates
 
I have DataTable with data and want to create dropdownlist to inside, but its not working. Kindly please help me and here is my logic below;.
  1. <link href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css" rel="stylesheet" />  
  2.   
  3.   
  4. @section scripts{  
  5.   
  6.     <script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>  
  7.       
  8.   
  9.     <script>  
  10.   
  11.         $(document).ready(function () {  
  12.   
  13.             $("#EventsManagementsTable").DataTable({  
  14.   
  15.                 "columnDefs": [  
  16.                     { "width""5%""targets": [0] },  
  17.                     { "className""text-center custom-middle-align""targets": [0, 1, 2, 3, 4, 5, 6] }  
  18.   
  19.                 ],  
  20.   
  21.                 "serverSide""true",  
  22.                 "order": [0, "asc"],  
  23.                 "processing""true",  
  24.                 "language": {  
  25.                     "processing""processing...... please wait"  
  26.                 },  
  27.   
  28.   
  29.                 "ajax": {  
  30.                     "url""/Dashboard/GetData",  
  31.                     "type""POST",  
  32.                     "datatype""JSON",  
  33.                     "columns": [{  
  34.                         "data""WhoAttend",  
  35.                         "name""WhoAttend",  
  36.                         "render": function (data, type, full) {  
  37.                             return '<select id= "dynamic_select" name= "dynamic_select">' +  
  38.                                 '<option id= "0" value= "TrainingType">Select</option>' +  
  39.                                 '<option id= "1" value= "TrainingDescription">Select</option>' +  
  40.                                 '<option id= "2" value= "Price"></option>' +  
  41.                                 '<option id= "3" value= "Value"></option>' +  
  42.                                 '<option id= "4" value= "Facilitator"></option>' +  
  43.                                 '<option id= "5" value= "WhoAttend"></option>' +  
  44.                                 '<option id= "0" value= "RSVP"></option>' +  
  45.                                 '</select>';  
  46.   
  47.                         },  
  48.                          
  49.                     }],  
  50.   
  51.                 },  
  52.                 "columns": [  
  53.                     { "data""TrainingType""name""TrainingType" },  
  54.                     { "data""TrainingDescription""name""TrainingDescription" },  
  55.                     { "data""Price""name""Price" },  
  56.                     { "data""Venue""name""Venue" },  
  57.                     { "data""Facilitator""name""Facilitator" },  
  58.                     { "data""WhoAttend""name""WhoAttend" },  
  59.                     { "data""RSVP""name""RSVP" },  
  60.   
  61.                 ]  
  62.   
  63.   
  64.             });  
  65.   
  66.   
  67.         });  
  68.   
  69.   
  70.   
  71.     </script>  
 

Answers (3)