JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Text Boxes & Inputs › textbox.valueMember not working? › Reply To: textbox.valueMember not working?
March 22, 2021 at 3:01 pm
#101649
yavordashew
Member
Hi Dark Beccio,
In your specific case I will suggest to use our ComboBox component and I have prepared a little code snippet on how to achieve the functionality you intend to.
//In your Js file :
window.onload = function () {
const comboBox = document.querySelector('smart-combo-box');
comboBox.dataSource = [
{ "label": "Afghanistan", "value": "AF" },
{ "label": "land Islands", "value": "AX" },
{ "label": "Albania", "value": "AL" },
{ "label": "Algeria", "value": "DZ" },
{ "label": "American Samoa", "value": "AS" },
{ "label": "AndorrA", "value": "AD" },
{ "label": "Angola", "value": "AO" },
{ "label": "Anguilla", "value": "AI" },
{ "label": "Antarctica", "value": "AQ" },
{ "label": "Antigua and Barbuda", "value": "AG" },
{ "label": "Argentina", "value": "AR" },
{ "label": "Armenia", "value": "AM" },
{ "label": "Aruba", "value": "AW" },
{ "label": "Australia", "value": "AU" },
{ "label": "Austria", "value": "AT" },
{ "label": "Yemen", "value": "YE" },
{ "label": "Zambia", "value": "ZM" },
{ "label": "Zimbabwe", "value": "ZW" }
];
setInterval(function(){
console.log('Value',comboBox.selectedValues)
},300)
};
//In you HTML file:
<smart-combo-box auto-complete="manual" min-length="1" selection-mode="zeroOrOne"></smart-combo-box>
One thing to have in mind although that these are different components they share similar functionality.
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/