Hopefully prevent double-bind of input change

Should fix addressbook contacts/organisation filter
This commit is contained in:
nathan 2022-03-01 15:15:24 -07:00
parent ae700fb391
commit 00f7b51fbd
2 changed files with 15 additions and 6 deletions

View File

@ -110,9 +110,17 @@ const Et2InputWidgetMixin = (superclass) =>
connectedCallback()
{
super.connectedCallback();
this._oldChange = this._oldChange.bind(this);
this.addEventListener("change", this._oldChange);
this.node = this.getInputNode();
}
disconnectedCallback()
{
super.disconnectedCallback();
this.removeEventListener("change", this._oldChange);
}
/**
* A property has changed, and we want to make adjustments to other things
* based on that
@ -144,12 +152,8 @@ const Et2InputWidgetMixin = (superclass) =>
* @param _ev
* @returns
*/
_onChange(_ev : Event) : boolean
_oldChange(_ev : Event) : boolean
{
if(typeof super._onChange == "function")
{
super._onChange(_ev);
}
if(typeof this.onchange == 'function')
{
// Make sure function gets a reference to the widget, splice it in as 2. argument if not

View File

@ -2185,6 +2185,10 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
get_columns()
{
const colMgr = this.dataview.getColumnMgr();
if(!colMgr)
{
return [];
}
const visibility = colMgr.getColumnVisibilitySet();
const colDisplay = [];
const custom_fields = [];
@ -3931,11 +3935,12 @@ export class et2_nextmatch_header_bar extends et2_DOMWidget implements et2_INext
if(_widget.localName && window.customElements.get(_widget.localName) !== "undefined")
{
// We could use addEventListener(), but callbacks expect these arguments
// @ts-ignore
_widget.onchange = (ev) =>
{
return change.call(this, _widget, _widget);
}
};
}
else
{