javascript - How to pass html in jquery datatables row add function -


following way im adding rows in jquery datatables angular

reviewmanger.getunapprovedreviews().then(function (data) {     if (data != null) {         var result = reviews.common.makevalidjson(data);         if (result != null) {             $scope.reviews = result;             var table = $("#editable");              var tp = table.datatable();             (var = 0; < $scope.reviews.length; i++) {                 tp.row.add([                     $scope.reviews[i].id,                     $scope.reviews[i].addedon,                     $scope.reviews[i].company.name,                     $scope.reviews[i].user.name,                     $scope.reviews[i].description,                     $sce.trustashtml("<span ng-click='enabledisable(" + $scope.reviews[i].id + ")>change</span>")                 ]).draw();             }         }     } }, function (error) { }); 

the problem i dont see rendered html in last column of rows in jquery data tables , other columns filled in rows.

how add html in jquery data table row?

i had compile angular template in order work used $compile angular following code changed :

  if (result != null) {                     $scope.reviews = result;                     var table: = $("#editable");                     //table.datatable();                     var tp = table.datatable();                      (var = 0; < $scope.reviews.length; i++) {                         var id = $scope.reviews[i].id;                         var checked = $scope.reviews[i].enabled == "1" ? true : false;                         tp.row.add(                             [                                 $scope.reviews[i].id,                                 $scope.reviews[i].addedon,                                 $scope.reviews[i].company.name,                                 $scope.reviews[i].user.name,                                 $scope.reviews[i].description,                                 "<div class='switch'><div class='onoffswitch'><input ng-checked='" + checked+"' class='onoffswitch-checkbox' id= 'stat" + id + "' type= 'checkbox'><label class='onoffswitch-label' for='stat" + id + "'><span class='onoffswitch-inner'></span><span class='onoffswitch-switch'></span></label></div></div>"                                 //"<div class='switch'><div class='onoffswitch'><input checked='' class='onoffswitch- checkbox' id= 'stat" + id + "' type= 'checkbox'><label class='onoffswitch- label' for='stat" + id + "'><span class='onoffswitch- inner'></span><span class='onoffswitch-switch'></span></label></div></div>"                                 //"<button ng-click='enabledisable(" + $scope.reviews[i].id + ")'>change</button>"                              ]                             );                     }                      tp.draw();                      $compile(table)($scope);                  } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -