Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
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
7 changes: 5 additions & 2 deletions src/app/modules/angular-slickgrid/editors/selectEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,13 @@ export class SelectEditor implements Editor {
}

isValueChanged(): boolean {
const valueSelection = this.$editorElm.multipleSelect('getSelects');
if (this.isMultipleSelect) {
return !dequal(this.$editorElm.val(), this.originalValue);
const isEqual = dequal(valueSelection, this.originalValue);
return !isEqual;
}
return this.$editorElm.val() !== this.originalValue;
const value = Array.isArray(valueSelection) && valueSelection.length > 0 ? valueSelection[0] : undefined;
return value !== this.originalValue;
}

validate(inputValue?: any): EditorValidatorOutput {
Expand Down
4 changes: 3 additions & 1 deletion src/app/modules/angular-slickgrid/filters/selectFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { castToPromise, getDescendantProperty, getTranslationPrefix, htmlEncode,
declare const $: any;

export class SelectFilter implements Filter {
protected _collectionLength = 0;
protected _isMultipleSelect = true;
protected _locales: Locale;
protected _shouldTriggerQuery = true;
Expand Down Expand Up @@ -168,7 +169,7 @@ export class SelectFilter implements Filter {
* Clear the filter values
*/
clear(shouldTriggerQuery = true) {
if (this.$filterElm && this.$filterElm.multipleSelect) {
if (this.$filterElm && this.$filterElm.multipleSelect && this._collectionLength > 0) {
// reload the filter element by it's id, to make sure it's still a valid element (because of some issue in the GraphQL example)
this.$filterElm.multipleSelect('setSelects', []);
this.$filterElm.removeClass('filled');
Expand Down Expand Up @@ -352,6 +353,7 @@ export class SelectFilter implements Filter {
// step 2, create the DOM Element of the filter & pre-load search terms
// also subscribe to the onClose event
this.createDomElement(filterTemplate);
this._collectionLength = newCollection.length;
}

/** Create the HTML template as a string */
Expand Down