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); now if user filter on column not available in data
and remove or cancel, not expand automatically
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
Post a Comment