0

I've been struggling with this error for a while now, I am trying to create a drop down list for the filter function on ui-grid but I seem to get a TypeError: Cannot read property 'SELECT' of undefined, the error occurs on line where type: uiGridConstants.filter.SELECT is stated.

Here is my code:


var columnDefs = [
            {name: "Updated by", field: "updatedBy", enableHiding: false, enableSorting:true, width: "*",enableFiltering: false},
            {name: "Date Updated", field: "updatedDateTime", enableHiding: false, enableSorting:true,width: "*",enableFiltering: false},
            {name: "Action Group", field: "actionGroup", enableHiding: false,enableSorting: true,
                filter: {
                    type: uiGridConstants.filter.SELECT,
                    selectOptions: groupTypes
                }
            },
            {name: "Action Performed", field: "actionPerformed", enableHiding: false, width: "75%"}
        ];

I have tried following the guide on the tutorial page of ui-grid but keep running into this error Thanks

1 Answer 1

1

Found the cause of the problem, basically I was passing uiGridConstants in the wrong order to the function, Eg:

What it was:

XXX.controller('XXXController', ['$location', '$scope','uiGridConstants', '$route', '$http', function ($location, $scope, $route, $http,uiGridConstants)

What it should be:

XXX.controller('XXXController', ['$location', '$scope','uiGridConstants', '$route', '$http', function ($location, $scope,uiGridConstants, $route, $http)

I know this is a really stupid mistake, but hopefully someone will someday see this and not waste time like I did

Sign up to request clarification or add additional context in comments.

1 Comment

Good that you caught your own trouble. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.