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

refactor: remove useless _filterValue property and related listeners #7284

Merged
merged 1 commit into from
Mar 28, 2024
Merged
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
27 changes: 1 addition & 26 deletions packages/grid/src/vaadin-grid-filter-column-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ export const GridFilterColumnMixin = (superClass) =>
}

static get observers() {
return ['_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header, _filterValue)'];
}

constructor() {
super();

this.__boundOnFilterValueChanged = this.__onFilterValueChanged.bind(this);
return ['_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header)'];
}

/**
Expand All @@ -54,16 +48,12 @@ export const GridFilterColumnMixin = (superClass) =>
textField.setAttribute('theme', 'small');
textField.setAttribute('style', 'max-width: 100%;');
textField.setAttribute('focus-target', '');
textField.addEventListener('value-changed', this.__boundOnFilterValueChanged);
filter.appendChild(textField);
root.appendChild(filter);
}

filter.path = this.path;
filter.value = this._filterValue;

textField.__rendererValue = this._filterValue;
textField.value = this._filterValue;
textField.label = this.__getHeader(this.header, this.path);
}

Expand All @@ -78,21 +68,6 @@ export const GridFilterColumnMixin = (superClass) =>
return this._defaultHeaderRenderer;
}

/**
* Updates the internal filter value once the filter text field is changed.
* The listener handles only user-fired events.
*
* @private
*/
__onFilterValueChanged(e) {
// Skip if the value is changed by the renderer.
if (e.detail.value === e.target.__rendererValue) {
return;
}

this._filterValue = e.detail.value;
}

/** @private */
__getHeader(header, path) {
if (header) {
Expand Down
Loading