Add missing change listener

This commit is contained in:
nathan 2022-02-28 13:45:47 -07:00
parent 9260f25476
commit 30ddeb79b0

View File

@ -297,6 +297,19 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(ValidateMixin(LitFl
super();
}
connectedCallback()
{
super.connectedCallback();
this._onChange = this._onChange.bind(this);
}
disconnectedCallback()
{
super.disconnectedCallback();
this._inputNode.removeEventListener('change', this._onChange);
}
/**
* Override parent to skip call to CDN
* @returns {Promise<void>}
@ -308,6 +321,10 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(ValidateMixin(LitFl
// await loadLocale(this.locale);
}
this.initializeComponent();
// This has to go in init() rather than connectedCallback() because flatpickr creates its nodes in
// initializeComponent() so this._inputNode is not available before this
this._inputNode.addEventListener('change', this._onChange);
}
/**