JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › smart-combo-box error set dataSource › Reply To: smart-combo-box error set dataSource
March 1, 2024 at 4:24 pm
#109913
Markov
Keymaster
Hi,
The only problem i could observe is that there are 1:, 2:, etc. in the provided data source which make it invalid array.
Below is a working sample:
const comboBox = document.querySelector("jqx-combo-box");
const vehileBrands = [{ id: 272, brand: 'GPS_TR08' },
{ id: 2, brand: 'GPS_CONCOX_GT06MDF' },
{ id: 3, brand: 'GPS_CONCOX_GT06' },
{ id: 4, brand: 'GPS_CONCOX_GT07' },
{ id: 5, brand: 'GPS_CONCOX_GT08' },
{ id: 6, brand: 'GPS_CONCOX_GT700' },
{ id: 7, brand: 'GPS_CONCOX_GT710' },
{ id: 8, brand: 'GPS_CONCOX_GT800' },
{ id: 9, brand: 'GPS_CONCOX_GT300' },
{ id: 10, brand: 'GPS_CONCOX_GT03C' },
{ id: 11, brand: 'GPS_CONCOX_GT02' },
{ id: 12, brand: 'GPS_CONCOX_GT02D' },
{ id: 13, brand: 'GPS_CONCOX_TR02' },
{ id: 14, brand: 'GPS_CONCOX_TR06' },
{ id: 15, brand: 'GPS_CONCOX_GK310' },
{ id: 16, brand: 'GPS_CONCOX_GK309E' },
{ id: 17, brand: 'GPS_CONCOX_GS503' },
{ id: 30, brand: 'GPS_CONCOX_HVT001' }
];
comboBox.valueMember = "id";
comboBox.displayMember = "brand";
comboBox.dataSource = vehileBrands;
comboBox.onchange = (event) => {
console.log(event.detail);
}
Regards,
Markov