JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › smart-combo-box error set dataSource
- This topic has 1 reply, 2 voices, and was last updated 8 months, 1 week ago by Markov.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
March 1, 2024 at 6:55 am #109906Joko PitoyoParticipant
i have problem set dataSource smart combobox,
const vehileBrands=[{id: 272, brand: 'GPS_TR08'} 1 : {id: 2, brand: 'GPS_CONCOX_GT06MDF'} 2 : {id: 3, brand: 'GPS_CONCOX_GT06'} 3 : {id: 4, brand: 'GPS_CONCOX_GT07'} 4 : {id: 5, brand: 'GPS_CONCOX_GT08'} 5 : {id: 6, brand: 'GPS_CONCOX_GT700'} 6 : {id: 7, brand: 'GPS_CONCOX_GT710'} 7 : {id: 8, brand: 'GPS_CONCOX_GT800'} 8 : {id: 9, brand: 'GPS_CONCOX_GT300'} 9 : {id: 10, brand: 'GPS_CONCOX_GT03C'} 10 : {id: 11, brand: 'GPS_CONCOX_GT02'} 11 : {id: 12, brand: 'GPS_CONCOX_GT02D'} 12 : {id: 13, brand: 'GPS_CONCOX_TR02'} 13 : {id: 14, brand: 'GPS_CONCOX_TR06'} 14 : {id: 15, brand: 'GPS_CONCOX_GK310'} 15 : {id: 16, brand: 'GPS_CONCOX_GK309E'} 16 : {id: 17, brand: 'GPS_CONCOX_GS503'} 17 : {id: 30, brand: 'GPS_CONCOX_HVT001'} ]; let cboGpsBrands=document.querySelector("#cboGpsBrands"); cboGpsBrands.valueMember="id"; cboGpsBrands.displayMember="brand"; cboGpsBrands.dataSource=vehileBrands;
Why does setting displayMember=”brand” not display brand data, but instead it shows id data?, when change property to label dan displayMember=”label” data will display
- This topic was modified 8 months, 1 week ago by Joko Pitoyo.
March 1, 2024 at 4:24 pm #109913MarkovKeymasterHi,
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 -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.