Angular ng mesh filter on only two columns

I want to make any request to an ng grid where it searches for both columns with the same filter text.

I figured out how to filter by column, but what I would like to do is filter on two columns with the same input.

var searchQuery = 'college:' + collegeText + ";" + 'curriculumName:' + $ scope.filterText + 'department:' + $ scope.filterText + ';';

It doesn't seem to work. I need to delete either the department or the training task in order to get the result. Apparently, he thinks he needs to find it in both columns in order to return the result.

+4
source share
1 answer

There is an example in this resource . Make a repo and load the page in a browser.

Basically, you can rely on the filterChanged event. Assuming you have a search bar in HTML:

 <input type="text" ng-model="filteringText" placeholder="Search..." class="search-query"/> 

The JavaScript part will look like this:

 // Initialize $scope.filteringText = ''; $scope.filterOptions = { filterText: 'filteringText', useExternalFilter: false }; // Configure ng-grid. $scope.gridOptions = { ... filterOptions: $scope.filterOptions, ... }; $scope.$on('filterChanged', function (evt, text) { console.log(text); $scope.filteringText = text; }); 
0
source

All Articles