{"action":"created","issue":{"url":"https://api.github.com/repos/esvit/ng-table/issues/751","labels_url":"https://api.github.com/repos/esvit/ng-table/issues/751/labels{/name}","comments_url":"https://api.github.com/repos/esvit/ng-table/issues/751/comments","events_url":"https://api.github.com/repos/esvit/ng-table/issues/751/events","html_url":"https://github.com/esvit/ng-table/issues/751","id":117329470,"number":751,"title":"Filter delay don't apply in some context","user":{"login":"nuxwin","id":125594,"avatar_url":"https://avatars.githubusercontent.com/u/125594?v=3","gravatar_id":"","url":"https://api.github.com/users/nuxwin","html_url":"https://github.com/nuxwin","followers_url":"https://api.github.com/users/nuxwin/followers","following_url":"https://api.github.com/users/nuxwin/following{/other_user}","gists_url":"https://api.github.com/users/nuxwin/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxwin/subscriptions","organizations_url":"https://api.github.com/users/nuxwin/orgs","repos_url":"https://api.github.com/users/nuxwin/repos","events_url":"https://api.github.com/users/nuxwin/events{/privacy}","received_events_url":"https://api.github.com/users/nuxwin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-17T10:52:00Z","updated_at":"2015-11-17T11:53:15Z","closed_at":"2015-11-17T11:53:15Z","body":"Hello,\r\n\r\nI'm using custom filter and when I try to delay filtering using the **filterDelay** option, this doesn't work.\r\n\r\nMy code:\r\n\r\nView:\r\n```html\r\n<div class=\"ApsPackageList\">\r\n\t<div ng-controller=\"ApsPackageController as PkgCtrl\" ng-init=\"PkgCtrl.packageTable()\" ng-cloak>\r\n\t\t<table ng-table=\"PkgCtrl.tableParams\" template-header=\"custom/header\" template-pagination=\"custom/pager\" ng-show=\"$data.length\">\r\n\t\t\t<tbody>\r\n\t\t\t<tr ng-repeat-start=\"package in $data\">\r\n\t\t\t\t<td class=\"Logo\" filter=\"{nbpages: 'custom/filters/nbpages'}\">\r\n\t\t\t\t\t<a ng-click=\"PkgCtrl.packageDetailsModal(package)\"><img ng-src=\"{{package.icon_url}}\" alt=\"\"></a>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class=\"Description\" filter=\"{category: 'select'}\" filter-data=\"PkgCtrl.categories\">\r\n\t\t\t\t\t<h4>\r\n\t\t\t\t\t\t<a ng-click=\"PkgCtrl.packageDetailsModal(package)\">{{package.name + ' - ' + package.version}}</a>\r\n\t\t\t\t\t</h4>\r\n\t\t\t\t\t{{package.summary}}\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class=\"Details\" ng-class=\"{ 'Locked': package.status == 'locked' }\" filter=\"{search: 'custom/filters/globalsearch'}\">\r\n\t\t\t\t\t<a ng-click=\"PkgCtrl.packageDetailsModal(package)\" translate>Details</a>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr ng-repeat-end>\r\n\t\t\t\t<td class=\"Version\" filter=\"{name: 'paging'}\">APS <b>{{package.aps_version}}</b></td>\r\n\t\t\t\t<td class=\"Info\">\r\n\t\t\t\t\t<span ng-if=\"package.package_cert != 'none'\" translate>Certified</span>\r\n\t\t\t\t\t<translate>Category:</translate> <b>{{package.category}}</b>\r\n\t\t\t\t\t<translate>Vendor:</translate> <a target=\"_blank\" ng-href=\"{{package.vendor_uri}}\">{{package.vendor}}</a>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class=\"Details\">\r\n\t\t\t\t\t<jq-button ng-if=\"isAuthorized(userRoles.admin)\" ng-click=\"PkgCtrl.packageUpdateStatus(package)\"\r\n\t\t\t\t\t           ng-value=\"package.status|apsTranslateStatus\"></jq-button>\r\n\t\t\t\t\t<jq-button ng-if=\"isAuthorized(userRoles.client)\"\r\n\t\t\t\t\t           ng-controller=\"NewApsInstanceController as NewApsInstanceCtrl\"\r\n\t\t\t\t\t           ng-click=\"NewApsInstanceCtrl.newInstanceModal(package)\"\r\n\t\t\t\t\t           value=\"{{'Install'|translate}}\"></jq-button>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tbody>\r\n\t\t\t<tfoot>\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan=\"3\" translate>Total packages: {{PkgCtrl.tableParams.total()}}</td>\r\n\t\t\t</tr>\r\n\t\t\t</tfoot>\r\n\t\t</table>\r\n\t\t<script type=\"text/ng-template\" id=\"custom/header\">\r\n\t\t\t<ng-table-filter-row></ng-table-filter-row>\r\n\t\t</script>\r\n\t\t<script type=\"text/ng-template\" id=\"custom/filters/nbpages\">\r\n\t\t\t<label>\r\n\t\t\t\t<select ng-model=\"count\" ng-change=\"params.count(count)\">\r\n\t\t\t\t\t<option ng-bind=\"count\" ng-value=\"count\" ng-repeat=\"count in params.settings().counts\"></option>\r\n\t\t\t\t</select>\r\n\t\t\t</label>\r\n\t\t</script>\r\n\t\t<script type=\"text/ng-template\" id=\"custom/filters/globalsearch\">\r\n\t\t\t<label><input type=\"text\" name=\"globalSearch\" placeholder=\"{{'Global search'|translate}}\" ng-model=\"PkgCtrl.filters.globalSearch\"></label>\r\n\t\t</script>\r\n\t\t<script type=\"text/ng-template\" id=\"custom/pager\">\r\n\t\t\t<div class=\"paginator\" ng-if=\"pages.length\">\r\n\t\t\t\t<span class=\"icon\" ng-class=\"{ 'i_prev': page.active, 'i_prev_gray': !page.active }\"\r\n\t\t\t\t      ng-repeat=\"page in pages\" ng-if=\"page.type == 'prev'\" ng-click=\"params.page(page.number)\"></span>\r\n\t\t\t\t<span class=\"icon\" ng-class=\"{ 'i_next': page.active, 'i_next_gray': !page.active }\"\r\n\t\t\t\t      ng-repeat=\"page in pages\" ng-if=\"page.type == 'next'\" ng-click=\"params.page(page.number)\"></span>\r\n\t\t\t</div>\r\n\t\t</script>\r\n\t\t<button ng-if=\"isAuthorized('admin')\" ng-click=\"PkgCtrl.packageUpdateIndex()\"\r\n\t\t        jq-confirm=\"{{'Are you sure you want to update the package index? Be aware that this task can take up to 5 minutes.'|translate}}\"\r\n\t\t        translate>\r\n\t\t\tUpdate package index\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n```\r\n\r\nJS:\r\n```javascript\r\n(function () {\r\n\t'use strict';\r\n\r\n\tangular.module('imscp.aps-standard.aps-package').controller('ApsPackageController', ApsPackageController);\r\n\r\n\tApsPackageController.$inject = ['$scope', '$http', 'ApsPackageResource', 'NgTableParams', 'DialogService', 'gettextCatalog', 'notification', '$window'];\r\n\r\n\tfunction ApsPackageController($scope, $http, ApsPackageResource, NgTableParams, DialogService, gettextCatalog, notification, $window) {\r\n\t\tvar vm = this;\r\n\r\n\t\tvm.packageTable = function () {\r\n\t\t\tvm.categories = $http.get('aps_packages.php', {params: {action: 'getCategories'}}).then(function (response) {\r\n\t\t\t\treturn response.data.map(function (resource) {\r\n\t\t\t\t\treturn {id: resource.category, title: resource.category.toUpperCase()};\r\n\t\t\t\t}).sort(function (a, b) {\r\n\t\t\t\t\tif (a.title > b.title) {\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (a.title < b.title) {\r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t});\r\n\t\t\t}).then(function (categories) {\r\n\t\t\t\tif (categories.length) {\r\n\r\n\t\t\t\t\t// Global search field\r\n\t\t\t\t\tvm.filters = {\r\n\t\t\t\t\t\tglobalSearch: ''\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tvm.tableParams = new NgTableParams(\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tpage: 1, // Show first page\r\n\t\t\t\t\t\t\tcount: 5, // Count per page\r\n\t\t\t\t\t\t\tfilters:  vm.filters\r\n\t\t\t\t\t\t}, {\r\n\t\t\t\t\t\t\tfilterDelay: 2000,\r\n\t\t\t\t\t\t\tgetData: function (params) {\r\n\t\t\t\t\t\t\t\treturn ApsPackageResource.query(params.url()).$promise.then(function (data) {\r\n\t\t\t\t\t\t\t\t\tparams.total(data.resourceCount);\r\n\t\t\t\t\t\t\t\t\treturn data.resources.map(function (resource) {\r\n\t\t\t\t\t\t\t\t\t\treturn new ApsPackageResource(resource);\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\tcounts: [5, 10, 25]\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnotification.notify(gettextCatalog.getString('No package available. You must update the package index.'), 'static_info', {timeout: -1});\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn categories;\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tvm.packageDetailsModal = function (pkg) {\r\n\t\t\tApsPackageResource.get({}, {id: pkg.id}).$promise.then(function (data) {\r\n\t\t\t\tdata = angular.merge(data, pkg);\r\n\r\n\t\t\t\tDialogService.open('PackageDetails', '/assets/angular/aps-standard/aps-package/aps-package-details-modal.tpl', data, {\r\n\t\t\t\t\ttitle: gettextCatalog.getString('Package details'),\r\n\t\t\t\t\tmodal: true,\r\n\t\t\t\t\twidth: $($window).width() / 2,\r\n\t\t\t\t\tmaxHeight: $($window).height() / 2\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tvm.packageUpdateStatus = function (pkg) {\r\n\t\t\tvar cStatus = pkg.status;\r\n\t\t\tpkg.status = cStatus == 'unlocked' ? 'locked' : 'unlocked';\r\n\t\t\tpkg.$update(null, null, function () {\r\n\t\t\t\tpkg.status = cStatus;\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tvm.packageUpdateIndex = function () {\r\n\t\t\tApsPackageResource.updateIndex(function () {\r\n\t\t\t\t$window.location = 'aps_packages.php';\r\n\t\t\t});\r\n\t\t};\r\n\t}\r\n})();\r\n```\r\n\r\nThe target filter is **globalSearch**. Note that attaching that filter on $scope doesn't solve the problem neither.\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/esvit/ng-table/issues/comments/157348386","html_url":"https://github.com/esvit/ng-table/issues/751#issuecomment-157348386","issue_url":"https://api.github.com/repos/esvit/ng-table/issues/751","id":157348386,"user":{"login":"nuxwin","id":125594,"avatar_url":"https://avatars.githubusercontent.com/u/125594?v=3","gravatar_id":"","url":"https://api.github.com/users/nuxwin","html_url":"https://github.com/nuxwin","followers_url":"https://api.github.com/users/nuxwin/followers","following_url":"https://api.github.com/users/nuxwin/following{/other_user}","gists_url":"https://api.github.com/users/nuxwin/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxwin/subscriptions","organizations_url":"https://api.github.com/users/nuxwin/orgs","repos_url":"https://api.github.com/users/nuxwin/repos","events_url":"https://api.github.com/users/nuxwin/events{/privacy}","received_events_url":"https://api.github.com/users/nuxwin/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T11:53:15Z","updated_at":"2015-11-17T11:53:15Z","body":"My mistake. I used **filters** option name instead of **filter**."}}