I have an Angularjs Smart Table where I have written my own logic to Filter the Array Items.
Earlier the logic was working fine because it was normal HTML table without any pagination but when I integrate my own array filter with the AngularJS Smart Table plugin its not working means items get filtered using ng-show so pagination or other filtered collection value are not getting changed because of this issue.
For Example: If I have 25 items in which 20 in the first page and 5 in the next page then when I do filtering using my own filter items will get filtered but State like pagination and all will not work it will still remain in the second page only whatever the items were there.
Code for the Array Filter(Multi Selection Dropdown):
<multiselect-dropdown model="SelectedStatus" options="Options" idprop="Value" displayprop="Value"></multiselect-dropdown>
My code for listing the row
<tr st-select-row="row" st-select-mode="multiple"
ng-repeat="row in display_records" |
ng-show="([row] | filterByArray:Selecteditem:'itemName').length">
Is there any way to avoid this ng-show and make the filter working in with smart table plugin itself. I have other text variable fields for those I am using normal st-search which works perfectly.
Update (My Array Filtering Code):
angular.module("App").filter('filterByArray', function () {
return function (list, arrayFilter, element) {
if (!angular.isUndefined(list) && !angular.isUndefined(arrayFilter) && arrayFilter.length > 0) {
var tempList = [];
angular.forEach(arrayFilter, function (id) {
angular.forEach(list, function (listItem) {
if (angular.equals(listItem[element], id)) {
tempList.push(listItem);
}
});
});
return tempList;
}
else
{
return list;
}
};
});
Looking for some solution where I can inject this myArray filter to Smart table state or refreshing smart table data when an array filter has been selected.