Hello,
We are trying to use ejs-combobox not only in a black form, we are trying to use in a edit form.
We are using this definition (simplified for better reading):
<ejs-combobox id='client' ref="clientSelector" floatLabelType="Auto" :fields='clientFields' :dataSource='clients' v-model="form.client_id" ></ejs-combobox>
Relevant definitions:
export default {
...
created() {
this.fetchClients();
this.fetch();
},
...
data: () => ({
form: new Form({
client_id: 0,
date: '',
total: 0,
description: '',
payed: false
}),
clients: [],
payment: [],
clientFields: { text: 'name', value: 'id' },
....
methods: {
fetch() {
axios.get(`/api/payments/${this.id}`)
.then(response => {
this.payment = response.data;
// Fill the form with user data.
this.form.keys().forEach(key => {
this.form[key] = this.payment[key];
});
})
.catch(error => console.log(error));
},
fetchClients(page) {
axios.get(`/api/clients/${this.id}`)
.then(response => {
this.clients = response.data;
})
.catch(error => console.log(error));
},
...
As you can see:
1) axios request is run asynchronously, so this.form.client_id can be populated after or before this.clients
2) if we set this.clients to a static array, when form.client_id is set, text is changed sucessfully. (this solution is not possible)
3) ej combo creation status is unknown when this.clients and / or form.client_id are assigned.
We have tryed to execute bind update method, to set this.clients again, etc.
In our opinion, when form.client_id and this.clients change, text must be reevaluated. Seems like control is conceived to work only with the same text/value, not with different fields in object.
Can you aid us?
Thank you.