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

Commit c8808f4

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
refactor(select): element remove should be more restrictive by it's name
- Multiple-Select Editor/Filter destroy method should make sure to remove the ms-drop as well which in Slickgrid is on the body container
1 parent 4e26ee0 commit c8808f4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/app/examples/grid-graphql.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ export class GridGraphqlComponent implements OnInit, OnDestroy {
7878
filterable: true,
7979
filter: {
8080
model: Filters.multipleSelect,
81-
collection: [{ value: 'acme', label: 'Acme'}, { value: 'abc', label: 'Company ABC'}, { value: 'xyz', label: 'Company XYZ'}]
81+
collection: [{ value: 'acme', label: 'Acme'}, { value: 'abc', label: 'Company ABC'}, { value: 'xyz', label: 'Company XYZ'}],
82+
filterOptions: {
83+
filter: true // adds a filter on top of the multi-select dropdown
84+
}
8285
}
8386
},
8487
{ id: 'billing.address.street', field: 'billing.address.street', headerKey: 'BILLING.ADDRESS.STREET', width: 60, filterable: true, sortable: true },

src/app/modules/angular-slickgrid/editors/selectEditor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ export class SelectEditor implements Editor {
261261
if (this.$editorElm && this.$editorElm.multipleSelect) {
262262
this.$editorElm.multipleSelect('close');
263263
this.$editorElm.remove();
264+
$(`[name=${this.elementName}].ms-drop`).remove();
264265
}
265266
this._subscriptions = unsubscribeAllObservables(this._subscriptions);
266267
}

src/app/modules/angular-slickgrid/filters/selectFilter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class SelectFilter implements Filter {
186186
if (this.$filterElm) {
187187
// remove event watcher
188188
this.$filterElm.off().remove();
189-
$('.ms-drop').remove();
189+
$(`[name=${this.elementName}].ms-drop`).remove();
190190
}
191191

192192
// also dispose of all Subscriptions
@@ -414,6 +414,7 @@ export class SelectFilter implements Filter {
414414
throw new Error(`multiple-select.js was not found, make sure to modify your "angular-cli.json" file and include "../node_modules/angular-slickgrid/lib/multiple-select/multiple-select.js" and it's css or SASS file`);
415415
}
416416
this.$filterElm.attr('id', this.elementName);
417+
this.$filterElm.attr('name', this.elementName);
417418
this.$filterElm.data('columnId', fieldId);
418419

419420
// if there's a search term, we will add the "filled" class for styling purposes

0 commit comments

Comments
 (0)