javascript - Datatable is not getting refreshed in angularjs -


i have bunch of data server call decided use datatable using angularjs. while implementing getting 10 records @ every pagination call. problem while clicking on next paging brings data , refelects datatable while clicking on previous paging brings data not refelected datatable. here chunk of angularjs code:-

appice.controller('appuserscontroller',     function ($scope,appiceservice, dtoptionsbuilder, dtcolumnbuilder, $q) {      function init(){         $scope.getappusers();     }      //$scope.dtinstance = {};     $scope.type = '';     $scope.getappusers = function(type){         $scope.type = type;         $scope.dtoptions = dtoptionsbuilder.newoptions()             .withfnserverdata(serverdata)             .withoption('processing', true)             .withoption('serverside', true)             .withoption('searchdelay', 350)             .withpaginationtype('full_numbers')             .withdisplaylength(10);          $scope.dtcolumns = [             dtcolumnbuilder.newcolumn('alias').withtitle('user'),             dtcolumnbuilder.newcolumn('fs').withtitle('user since'),             dtcolumnbuilder.newcolumn('sc').withtitle('#of sessions'),             dtcolumnbuilder.newcolumn('ad').withtitle('average duration'),             dtcolumnbuilder.newcolumn('ca').withtitle('competing apps'),             dtcolumnbuilder.newcolumn('interest').withtitle('interests'),             dtcolumnbuilder.newcolumn('engage').withtitle('campaign engagement'),             dtcolumnbuilder.newcolumn('cac').withtitle('cac'),             dtcolumnbuilder.newcolumn('ltv').withtitle('ltv'),             dtcolumnbuilder.newcolumn('permission').withtitle('permission')         ];     }      $scope.getusers = function(usertype){         $scope.getappusers(usertype);     }      function serverdata(ssource, aodata, fncallback, osettings) {         //all parameters need in aodata variable        /* var draw = aodata[0].value;         var order = aodata[2].value;*/         var start = aodata[3].value;         //console.log('draw::'+draw+" order:"+order+" start:"+start);         var length = aodata[4].value;         var searchtext = aodata[5].value.value;         var promise = appiceservice.getappusers($scope.type, start, length, searchtext);         promise.then(function(result) {             if(result){                 var records = {                         'draw': result.draw,                         'recordstotal': result.recordstotal,                         'recordsfiltered': result.recordsfiltered,                         'data': result.data                       };                 //$scope.rerender();                 //$scope.dtinstance.rerender();                  fncallback(records);                 $scope.$apply();                 //console.log('records:'+json.stringify(records));             }             else{                 console.log('else records::')                 fncallback({});             }                     });     }      init(); }); 

and html code.

<table datatable="" dt-options="dtoptions" dt-columns="dtcolumns" dt-instance="dtinstance" class="table table-striped table-bordered"></table> 

i not able understand going wrong in while implementing datatable using angularjs .


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -