angularjs - using expandable Angular js ui grid -


i using expandable ui grid. , refreshing grid data in every 5 secs. issue f expand row closed in every 5s(as grid refreshes).

please suggest how can make row expanded grid refreshed data.

code $scope.fillproductlist = function() { $http({ method: 'get', url: getjobs, data: {} }).success(function(result) {

                $scope.showsublistgrid = false;                 $scope.mydata= '';                 var griddatawithdownload =  result;                  //grid data                 $scope.mydata = griddatawithdownload;                  $scope.gridoptionscategory.data = griddatawithdownload;               //   $scope.refresh = false;                  timer = $timeout(function() {                     $scope.fillproductlist();                 }, timeoutstamp);              }).error(function(result) {                                     timer = $timeout(function() {                     $scope.fillproductlist();                 }, timeoutstamp);              });         }; 

$scope.gridoptionscategory = {
useexternalpagination: true, expandablerowheight: 300,

             enablesorting: true,              data: $scope.mydata,              enablecolumnresizing: true,             enablegridmenu: false,             expandablerowtemplate: 'griddata.html',              onregisterapi: function(gridapi) {                 $scope.gridapi = gridapi;              //  gridapi.expandable.togglerowexpansion($scope.gridapi.grid.row[0].entity);                 gridapi.expandable.on.rowexpandedstatechanged($scope, function (row) {                      $scope.gridapi.grid.modifyrows($scope.gridoptionscategory.data);                      $scope.gridapi.selection.selectrow($scope.gridoptionscategory.data[0]); //$scope.gridoptionscategory.expandablerowheight = 500;                     //$timeout.cancel(timer);                                            if (row.isexpanded) {                              row.entity.components = json.parse(row.entity.components)                             this.scope.gridoptionscategory.expandablerowscope = row.entity;                      // $scope.gridoptions.expandablerowscope = row.entity.components;                      }if (!row.isexpanded) {                             timer = $timeout(function() {                                 $scope.fillproductlist();                             }, timeoutstamp);                      }                 });                },             enablehorizontalscrollbar: 0,              //enableverticalscrollbar:0,              //useexternalsorting: true,             columndefs: [                     {                         field: 'filtertoggle', displayname: '', visible: true,  headercelltemplate: '' +                             '<button id=\'togglefiltering\' style= "padding:3px 7px;" ng-click="grid.appscope.togglefiltering()" class="btn btn-warning glyphicon glyphicon-filter">' +                             '</button>'                     },                     {                     name: 'job name',                     field: 'name',                      width: '20%',                                            enablecelledit: false,                     enablehiding: true,                     enablegrouping: false,                  //  enablefiltering: true,                     filter: {                         term: $scope.filteroptions.filtertext                     }                 },                 {                     name: 'profile',                     field: 'profile',                     width: '15%',                     enablecelledit: false,                     enablehiding: true,                     enablegrouping: false                 },                  {                     name: 'progress',                     field: 'progress',                     enablesorting:true,                     width: '18%',                     enablecelledit: false,                     enablehiding: true,                     enablegrouping: false,                 //  enablefiltering: true,                                           celltemplate: statustemplate                 }                 ]         };      

gridapi.core.on.rowsrendered(scope,() => {         if (!gridapi.grid.expandable.expandedall && !initialized)                  {   gridapi.expandable.expandallrows();             initialized = true;          } }); 

can check these code. might idea.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -