Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 2a5a351

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
fix ClearFilters not working with GraphQL & OData Services
1 parent 2c850d4 commit 2a5a351

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/app/modules/angular-slickgrid/services/filter.service.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,20 @@ export class FilterService {
7979

8080
/** Clear the search filters (below the column titles) */
8181
clearFilters() {
82-
// remove the text inside each search input fields
83-
$('.slick-headerrow-column .search-filter').val('');
82+
// remove the text inside each search filter fields
83+
$('.slick-headerrow-column .search-filter').each((index: number, elm: HTMLElement) => {
84+
// clear the value and trigger an event
85+
// the event is for GraphQL & OData Services to detect the changes and call a new query
86+
switch (elm.tagName) {
87+
case 'SELECT':
88+
$(elm).val('').trigger('change');
89+
break;
90+
case 'INPUT':
91+
default:
92+
$(elm).val('').trigger('keyup');
93+
break;
94+
}
95+
});
8496

8597
// we need to loop through all columnFilters and delete them 1 by 1
8698
// only trying to make columnFilter an empty (without looping) would not trigger a dataset change

src/app/modules/angular-slickgrid/services/gridExtra.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export class GridExtraService {
9090
}
9191
}
9292

93-
/** Add an item (data item) to the datagrid
93+
/**
94+
* Add an item (data item) to the datagrid
9495
* @param object dataItem: item object holding all properties of that row
9596
*/
9697
addItemToDatagrid(item) {
@@ -113,7 +114,8 @@ export class GridExtraService {
113114
const datasetLength = this._dataView.getLength();
114115
}
115116

116-
/** Update an existing item with new properties inside the datagrid
117+
/**
118+
* Update an existing item with new properties inside the datagrid
117119
* @param object item: item object holding all properties of that row
118120
*/
119121
updateDataGridItem(item: any) {

0 commit comments

Comments
 (0)