Skip to content

Commit

Permalink
Merge pull request #225 from mwaylabs/feature/MDM-15994_fix_search_bar
Browse files Browse the repository at this point in the history
MDM-15994: Fix broken initial state of searchbar, remove unnecessary …
  • Loading branch information
drisoftie authored Aug 10, 2018
2 parents 313a07f + 5961d7f commit f1df458
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.23.3
## Features
- Fix broken initial state of searchbar (#222)

# v1.23.2
## Features
- Make option group body clickable to select option (#214)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mw-uikit",
"description": "A toolbox to build portals with AngularJS 1.5.x that have a lot of forms and list views for example admin portals to manage data.",
"author": "Alexander Zarges <[email protected]> (http://relution.io)",
"version": "1.23.2",
"version": "1.23.3",
"license": "Apache-2.0",
"devDependencies": {
"angular": "1.5.7",
Expand Down
13 changes: 3 additions & 10 deletions src-relution/mwComponentsBb.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ angular.module('mwComponentsBb', [])
scope.inputSearchId = scope.inputSearchId || 'mw_input_search_field';
var inputEl = el.find('input'),
collection,
listCollectionFilter,
canSearch = false;
listCollectionFilter;

var setFilterVal = function (val) {
if (scope.customUrlParameter) {
Expand All @@ -64,7 +63,7 @@ angular.module('mwComponentsBb', [])
};

scope.search = function () {
if (canSearch && scope.viewModel.searchVal.length >= scope.minLength) {
if (scope.viewModel.searchVal.length >= scope.minLength) {
scope.searching = true;
//backup searched text to reset after fetch complete in case of search text was empty
setFilterVal(scope.viewModel.searchVal);
Expand All @@ -75,6 +74,7 @@ angular.module('mwComponentsBb', [])
});
} else {
$q.reject();
scope.searching = false;
}
};

Expand Down Expand Up @@ -136,16 +136,9 @@ angular.module('mwComponentsBb', [])
}
}, function (val) {
if (val && val !== scope.viewModel.searchVal) {
canSearch = true;
scope.viewModel.searchVal = val;
}
});

scope.$watch('viewModel.searchVal', function (val) {
if (val && val.length > 0) {
canSearch = true;
}
});
}
};
})
Expand Down

0 comments on commit f1df458

Please sign in to comment.