Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #101648
    Dark Beccio
    Member

    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
     
     

    #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/

    #101652
    Dark Beccio
    Member

    ty, i just added filterCliente.selectedValues = [“IDCliente”]; in //params SET and it’s working

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.