JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Text Boxes & Inputs › textbox.valueMember not working?
- This topic has 2 replies, 2 voices, and was last updated 3 years, 8 months ago by Dark Beccio.
-
AuthorPosts
-
March 22, 2021 at 12:17 pm #101648Dark BeccioMember
hi, i made this function for data source callback in my textbox
function filterComboBoxClienti() {
const filterCliente = document.getElementById(‘MytextBox’);
//params SET
filterCliente.displayMember = ‘Denominazione’;
filterCliente.valueMember = ‘IDCliente’;
filterCliente.dataSource = function (query, callback) {
let returnFindPF = refreshComboBoxClienti(query);
let result = [];
let ritorno = returnFindPF.responseJSON;
for (let d = 0; d < ritorno.length; d++) {
result.push((ritorno[d]));
}
setTimeout(function () {
callback(result);
}, 100);
};
}
displayMember working just fine , after i select one entry in autocomplete my result array is like this
result: Array(1)
0:
Annullato: “0”
Cap: “3013”
Citta: “FERENTINO”
Codice: “150260”
CodiceFiscale: “”
6-Denominazione: “A.L.T. SNC DI PICCIRILLI TERESA”
Email: “”
EsenteIva: “”
IDAzienda: “1”
10-IDCliente: “1972”
IDClientiArea: “3”
IDClientiCanale: “25”
IDLeggeIva: “”
IDMarchio: “2”
Indirizzo: “VIA CASILINA 135/B”
PartitaIva: “”
Provincia: “FR”
Telefono: “0775393243”
cliAreaDescrizione: “Lazio”
cliCanaleCodice: “230”
codDenominazione: “A.L.T. SNC DI PICCIRILLI TERESA 150260”
marchioArtDescrizione: “CONAD + PQC”
value number 6 is my displayMember and number 10 should be my valueMember but if i call
document.getElementById(‘MytextBox’).value it contains the actual input(displayMember) but i need the valueMember //Params SET
what can i do?
ty
March 22, 2021 at 3:01 pm #101649yavordashewMemberHi 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/March 22, 2021 at 4:20 pm #101652Dark BeccioMemberty, i just added filterCliente.selectedValues = [“IDCliente”]; in //params SET and it’s working
-
AuthorPosts
- You must be logged in to reply to this topic.