Angularjs ui-grid filter cancel event -


hi using angular ui grid, have filter , grouping in grid expanding default rows using following

$scope.expandall = function(){     $scope.gridapi.treebase.expandallrows();   };   $timeout(function() {     $scope.expandall(); }, 500); 

enter image description here

now if user filter on column not available in data

enter image description here

and remove or cancel, not expand automatically

enter image description here

it shows above

i need rows expand automatically when user clear or cancel filter data

i found there event filterchanged, don't know how use that

i using following plunkr testing

http://plnkr.co/edit/hhiw9r9ax1jlfe4nodjq?p=preview

thanks

modify onregisterapi method following

onregisterapi: function( gridapi ) {   $scope.gridapi = gridapi;   $scope.gridapi.core.on.filterchanged($scope, function() {             var grid = this.grid;     var isfilterclear = true;     angular.foreach(grid.columns, function( col ) {       if(col.filters[0].term){         isfilterclear = false;       }     });     if(isfilterclear) {         $timeout(function() {             $scope.expandall();         },500);     }   }); } 

see plunkr http://plnkr.co/edit/1fwdie?p=preview


Comments

Popular posts from this blog

php - Extract Text from HTTP referer -

Receive udp packets in android gstreamer -

authentication - ASP.NET Core 1.0. Bearer Token, cannot access custom claims -