Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Run the following ommands:
npm install
bower install
gulp

## Setup

#### Install
Expand All @@ -49,7 +49,7 @@ Keyboard in your module's run section.
#### JS/CSS Imports (index.html)
Include the following JavaScript/CSS file imports in your index.html. Remember to import the ionic libraries first!
The example below assumes your 3rd party bower dependencies are located in the default bower_components folder.

<link rel="stylesheet" href="bower_components/ionic-filter-bar/dist/ionic.filter.bar.css">
<script src="bower_components/ionic-filter-bar/dist/ionic.filter.bar.js"></script>

Expand Down Expand Up @@ -155,7 +155,7 @@ A service you can inject in your controller to show the filter bar

@param {object} options The options for the filterBar. Properties:


- `[Object]` `items`

The array of items to filter. When the filterBar is cancelled or removed, the original list of items will
Expand All @@ -165,7 +165,7 @@ A service you can inject in your controller to show the filter bar
- `{function=}` `update`

Called after the items are filtered. The new filtered items will be passed to this function which can be used
to update the items on your controller's scope. The text string that was searched on will be passed as the
to update the items on your controller's scope. The text string that was searched on will be passed as the
second argument.


Expand Down Expand Up @@ -194,32 +194,32 @@ A service you can inject in your controller to show the filter bar

- `{function=}` `expression`

The predicate to be used for selecting items from the `items` array. This is similar to the angular filter
`expression` function described [here](https://docs.angularjs.org/api/ng/filter/filter), except that the first
The predicate to be used for selecting items from the `items` array. This is similar to the angular filter
`expression` function described [here](https://docs.angularjs.org/api/ng/filter/filter), except that the first
argument will be the filterText as shown below. Default value is `null`.
NOTE: This property will take precedence over `filterProperties`. Only one can be defined.

function (filterText, value, index, array) {
return value.propertyName === filterText || value.anotherPropertyName === filterText;
}

- `{function,true,false,undefined=}` `comparator`

Determines if the expected value (from the filter expression) and actual value (from the object in the array)
should be considered a match. This is the same as the angular filter `comparator` argument described [here](https://docs.angularjs.org/api/ng/filter/filter).
Determines if the expected value (from the filter expression) and actual value (from the object in the array)
should be considered a match. This is the same as the angular filter `comparator` argument described [here](https://docs.angularjs.org/api/ng/filter/filter).
Default value is `undefined`.

- `[String]` `filterProperties`

A string or string array of object properties that will be used to create a filterExpression object for
filtering items in the array. All properties will be matched against the input filter text. For example, given
filtering items in the array. All properties will be matched against the input filter text. For example, given
the following object in an array of items , and assume the user searches for "fish"

{name: 'fish', description: 'fish', color: 'blue'}

filterProperties: ['name', 'description'] ... The object will be matched and passed to the array in `update`
filterProperties: ['name', 'color'] ... The object will NOT be matched or passed to the array in `update`

NOTE: If `expression` is defined, `filterProperties` will have no effect. Only one can be defined. Default
value is null.

Expand Down Expand Up @@ -252,6 +252,11 @@ A service you can inject in your controller to show the filter bar
- `.modal` (Appends to a modal)
- `.menu-content` (Appends to the content section of a side menu. Useful when the expose-aside-when attr is set.)

- `{boolean=}` `focusOnShow`

Whether to focus the search input on filterBar show. If false, backdrop will be hidden. Default value is true.


## Screenshots


Expand Down
11 changes: 7 additions & 4 deletions dist/ionic.filter.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ angular.module('jett.ionic.filter.bar', ['ionic']);
cancelEl.bind('click', cancelFilterBar);

// If backdrop is enabled, create and append it to filter, then add click/swipe listeners to cancel filter
if ($scope.config.backdrop) {
if ($scope.config.backdrop && $scope.focusOnShow) {
backdrop = angular.element('<div class="filter-bar-backdrop"></div>');
$element.append(backdrop);

Expand Down Expand Up @@ -387,7 +387,8 @@ angular.module('jett.ionic.filter.bar', ['ionic']);
delay: 300,
cancelText: 'Cancel',
cancelOnStateChange: true,
container: $body
container: $body,
focusOnShow: true,
}, opts);

//if no custom theme was configured, get theme of containers bar-header
Expand Down Expand Up @@ -561,8 +562,10 @@ angular.module('jett.ionic.filter.bar', ['ionic']);

$timeout(function () {
filterWrapperEl.addClass('filter-bar-in');
scope.focusInput();
scope.showBackdrop();
if (scope.focusOnShow) {
scope.focusInput();
scope.showBackdrop();
}
(done || angular.noop)();
}, 20, false);
});
Expand Down
2 changes: 1 addition & 1 deletion dist/ionic.filter.bar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/ionic.filter.bar.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
cancelEl.bind('click', cancelFilterBar);

// If backdrop is enabled, create and append it to filter, then add click/swipe listeners to cancel filter
if ($scope.config.backdrop) {
if ($scope.config.backdrop && $scope.focusOnShow) {
backdrop = angular.element('<div class="filter-bar-backdrop"></div>');
$element.append(backdrop);

Expand Down
Loading