I have implemented angular UI-Grid, and it's single filter but the filter is only working for 2 characters, it's not showing any columns if whole string/column value is put in the input box. Below is my code,
<input class="form-control" ng-change="refreshData(searchText)" placeholder="Search" ng-model="searchText" />
<div id="grid1" ng-if="gridOptions.data.length>0" ui-grid="gridOptions" ui-grid-pagination class="grid grid-fontSize"></div>
JS code,
$scope.refreshData = function (termObj) {
$scope.gridOptions.data = data;
while (termObj) {
var oSearchArray = termObj.split(' ');
$scope.filterGrid1.data = $filter('filter')($scope.gridOptions.data, oSearchArray[0], undefined);
oSearchArray.shift();
termObj = (oSearchArray.length !== 0) ? oSearchArray.join(' ') : '';
}
};
I am getting data from http call and saving into data variable and using it for search and populating data to the grid. Note: I have also tried ,
$scope.refreshData = function() {
$scope.gridOptions.data = $filter('filter')(data, $scope.searchText, undefined);
};
But neither of them is working, it only works for the 2 characters , but when I put the whole string, even though there is matching column grid doesn't shows anything.
Any solution or ideas will be helpful, Thanks in advance. Here is a plunker plunker, implementation having the same issue, also I want a search on the select, dropdown also for the second field, Issue: - Gladys Rivas, record is there, if I am searching with "Gladys Rivas" no result, but if with "Gla" I can see the record.