0

im using the ui-grid and have a input Box. I want to bind the input box as a filter to the column in the grid. I dont want to use the buildin textbox in the ui-grid.

can anyone help ?

2 Answers 2

2
  1. in gridOption.columnDefs, set the column you want to filter, for example: { field: 'gender', enableFiltering: false } to disable inline filter
  2. get the grid state using gridApi
  3. find your column in state.columns and add your filter to it.
  4. restore grid state which is to apply your filter to the grid I made you a plunker. http://plnkr.co/edit/p878r7GsFig1goX5rroK?p=preview
Sign up to request clarification or add additional context in comments.

Comments

0

As I was looking for the same kind of things, sunz7 answer helped me, but then, you can improve it, as in this state, the plunker provided by sunz7 do not allow to change the search. A new click on the button will trigger a search within the previous search.

And as bonus, an empty search field will remove the filter, just by changing

$scope.state.columns[1].filters.push({term: $scope.genderFilter});

by

$scope.state.columns[1].filters[0] = {term: $scope.genderFilter || '*'};

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

This fork of the plunker fix that.

Comments

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.