Skip to content

Commit

Permalink
fix: checkbox any data was not binding correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ATHULKNAIR committed Apr 4, 2022
1 parent 96c983e commit 1336588
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/medblocks/context/checkboxAny.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ import EhrElement from '../EhrElement';
@customElement('mb-checkbox-any')
export default class MbCheckBox extends EhrElement {
@property({ type: Object }) data: any = undefined;
@property({ type: Object }) checked: boolean;
@property({ type: Object }) bind: any = undefined;
@property({ type: Boolean, reflect: true }) disabled: boolean = false;
_handleChange(e: CustomEvent) {
const checkbox = e.target as SlCheckbox;
this.data = checkbox.checked ? this.bind : undefined;
}

connectedCallback() {
super.connectedCallback();
this.data = this.checked ? this.bind : undefined;
}

render() {
return html`<sl-checkbox
?disabled=${this.disabled}
?checked=${this.data ? true : false}
?checked=${this.checked ? true : false}
@sl-change=${this._handleChange}
>${this.label}</sl-checkbox
>`;
Expand Down

0 comments on commit 1336588

Please sign in to comment.