Hello,
Where can i find an example of vaadin-combo-box webcomponent created in a LitElement render method ?
I try to implement with dynamic data provider and filter capability but I can’t find the right way.
Thanks
static get properties() {
return {
ref_id : String,
label : String,
required : {
type : Boolean,
default : false
},filter: {
type: String,
observer: '_filterChanged'
},
loading: Boolean,
repos: {
type: Array,
value: function () {
return [];
}
},
repo: String
};
}
render() {
return html`
<vaadin-combo-box
id="${this.ref_id}"
label="${this.label}"
?required=${this.required}
error-message="${this.error_message}"
value="${this.repo}"
filter="${this.filter}"
loading="${this.loading}"
filtered-items="${this.repos}"
@change='${this._setValue}'
></vaadin-combo-box>
`;
}
firstUpdated(changedProperties) {
this._combo = this.shadowRoot.getElementById(`${this.ref_id}`);
//this._combo.dataProvider = this._search;
}
_filterChanged() {
this.debounce('filter', this._search, 500);
}
_search() {
//if (!this.filter) return;
this.loading = true;
console.log(this.filter);
http.get(`${ServerBase}combo_1.json`)
.then(data => {
this.repos = data.items.map(repo => repo['code']
);
console.log(this.repos);
//this._combo.filteredItems = this.repos;
this.loading = false;
}).catch(() => this.loading = false);
}