I would like to be able to set/update a value in my controller that is then filtered in the grid. Currently, the changes to the filter aren't updated until I type into the grid which then triggers the filterChanged event. Any idea of how I can automatically filter the data in my grid config or at least do a hard refresh?
Thank you for the help.
Here's a slightly modified Plunker from the AngularJS UI Grid website. http://plnkr.co/edit/pgX31NT3Ry3XllZ3JO2B?p=preview
Here's my current filter definition in the columnDefs section:
{ field: 'company', filter: {
noTerm: true,
condition: function(searchTerm, cellValue) {
return cellValue == scope.term;
}
When you define your gridOptions
, set the gridAPI variable with the following:
onRegisterApi: function(gridApi){
$scope.gridApi = gridApi;
},
And then in your update function, run the following to re-evaluate the filter condition:
$scope.gridApi.grid.refresh()
As @Conan mentioned, a breaking update was released and this works only in
There was a bug and this doesn't work on 3.2.x. Tested and works in 3.1.x and 4.x http://plnkr.co/edit/YbgV9YZrWCZE4cc3qGru?p=preview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With