diff --git a/UI/Templates/ContactsUI/UIxContactFoldersView.wox b/UI/Templates/ContactsUI/UIxContactFoldersView.wox index 148bee81b..cde883fc1 100644 --- a/UI/Templates/ContactsUI/UIxContactFoldersView.wox +++ b/UI/Templates/ContactsUI/UIxContactFoldersView.wox @@ -366,6 +366,12 @@ +
+ +
= 0; index--) { - card = cards[index]; - if (_.isUndefined(_.find(results, compareIds, card))) { - cards.splice(index, 1); - } - } - - // Add new cards - _.each(results, function(data, index) { - if (_.isUndefined(_.find(cards, compareIds, data))) { - var card = new AddressBook.$Card(data); - cards.splice(index, 0, card); - } - }); - - return cards; - }); + return this.$filter(); }; /** @@ -330,6 +304,8 @@ AddressBook.prototype.$filter = function(search, options, excludedCards) { var _this = this; + this.$isLoading = true; + return AddressBook.$Preferences.ready().then(function() { if (options) { angular.extend(AddressBook.$query, options); @@ -347,7 +323,8 @@ } } - AddressBook.$query.value = search; + if (angular.isDefined(search)) + AddressBook.$query.value = search; return _this.$id().then(function(addressbookId) { return AddressBook.$$resource.fetch(addressbookId, 'view', AddressBook.$query); @@ -396,6 +373,7 @@ cards.splice(index, 0, removedCards[0]); } }); + _this.$isLoading = false; return cards; }); }); @@ -528,6 +506,8 @@ _this.$startRefreshTimeout(); + _this.$isLoading = false; + return _this; }); }, function(data) {