Search code examples
angular-ui-grid

ui grid filter toggling not working, "type was not recognised"?


I have a filter toggling button for toggle $scope.uiGridOptions.enableFiltering .

$scope.toggleFiltering= function () {
        $scope.uiGridOptions.enableFiltering = !$scope.uiGridOptions.enableFiltering;
        $scope.gridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
    }

{{uiGridOptions.enableFiltering}} changes true and false, but filter in my grid doesn't hide/show.

  $scope.uiGridOptions = {
        enableFiltering:true,//default
        onRegisterApi: function (gridApi) {
            $scope.gridApi = gridApi;
        },
        columnDefs: [                
             {
                 field: 'name'
                 , name: 'Name'

             }]
  }

And in console, following error shows.

Notified of a data change, but the type was not recognised, so no action taken, type was: undefined
(anonymous function)
d.service.q.logError
o.notifyDataChange
d.service.q.createBoundedWrapper
$scope.toggleFiltering
ib.functionCall
Dc.(anonymous function).compile.d.on.f
$get.l.$eval
$get.l.$apply
(anonymous function)
jQuery.event.dispatch
jQuery.event.add.elemData.handle

I hope someone can help me.


Solution

  • This has happened me because I was using the latest 'official' 3.0.0-rc.20. Try to use an unstable version of the ui-grid from github. This fixed my problem. Moreover, I'm using version 1.2.28 of Angular.