Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a button to clear the filter on item lists #1185

Merged
merged 1 commit into from
May 30, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Reduce memory use in a mongo aggregation pipeline ([#1183](../../pull/1183))
- Remove rasterio dep on pyproj ([#1182](../../pull/1182))
- Filter on specific metadata from item lists ([#1184](../../pull/1184))
- Add a button to clear the filter on item lists ([#1185](../../pull/1185))

## 1.22.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ ul.g-item-list
label
padding-left 5px
font-weight normal

.li-item-list-filter-clear
cursor pointer
15 changes: 13 additions & 2 deletions girder/girder_large_image/web_client/views/itemList.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ wrap(ItemListWidget, 'render', function (render) {
addToRoute({filter: this._generalFilter});
};

this._clearFilter = (evt) => {
this._generalFilter = '';
this._setFilter();
addToRoute({filter: this._generalFilter});
};

this._unescapePhrase = (val) => {
if (val !== undefined) {
val = val.replace('\\\'', '\'').replace('\\"', '"').replace('\\\\', '\\');
Expand Down Expand Up @@ -356,12 +362,18 @@ wrap(ItemListWidget, 'render', function (render) {
'Column and value names can be quoted to include spaces (single quotes for substring match, double quotes for exact value match). ' +
'If <column>:-<value1>[,<value2>...] is specified, matches will exclude the list of values. ' +
'Non-exact matches without a column specifier will also match columns that start with the specified value. ' +
'"></input></span>');
'"></input>' +
'<span class="li-item-list-filter-clear"><i class="icon-cancel"></i></span>' +
'</span>');
if (this._generalFilter) {
root.find('.li-item-list-filter-input').val(this._generalFilter);
}
this.parentView.events['change .li-item-list-filter-input'] = this._updateFilter;
this.parentView.events['input .li-item-list-filter-input'] = this._updateFilter;
this.parentView.events['click .li-item-list-filter-clear'] = (evt) => {
this.parentView.$el.find('.li-item-list-filter-input').val('');
this._clearFilter();
};
this.parentView.delegateEvents();
}
}
Expand Down Expand Up @@ -502,7 +514,6 @@ function itemListCellFilter(evt) {
this._setFilter();
addToRoute({filter: this._generalFilter});
this._setSort();
this.render();
return false;
}

Expand Down