JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums ComboBox filling in a combo box using jScript

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #104219
    edwardsmarkff
    Participant

    greetings –

    https://codepen.io/edwardsmarkf/pen/XWBazzR

    i am having trouble getting a jScript-created combo box to fill in the text data properly.
    as you can see from the example, its not displaying at all, even though the DOM “thinks” it is displayed.  i can fill it in after its created, but not before.

    please advise what i might be doing incorrectly.

    and THANK YOU AGAIN for smart-html-elements!

     

    • This topic was modified 1 year, 10 months ago by edwardsmarkff.
    #104223

    Hi,

    The problem is that you are trying to import 99 times the same value.
    Please see this demo in which I am importing different values.

    In the demo, the upper combo box is filled with a for loop
    and the second combo box’s data is being loaded with the dataSource property

    Here is a link for its API: https://www.htmlelements.com/docs/combobox-api/

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

    #104224
    edwardsmarkff
    Participant

    i am sorry that my question was not clear:

    https://codepen.io/edwardsmarkf/pen/XWBazzR

    
    let element = document.createElement('smart-combo-box');
    element.value = 'default value!';
    

    providing the value does not appear to be working for me, as you can see, the provided value is not displaying.  i am only seeing a blank.

    EDIT:

    this statement works fine:

    
    document.querySelector('smart-combo-box').setAttribute('value', 'test');
    

     

     

    #104235

    Hi,

    Please, use the smart-combo-box tag and you should have no problem.
    See here: https://codepen.io/svetoslavb04/pen/GRBMZKj

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

    #104238
    edwardsmarkff
    Participant

    yes i agree with you, but please see my example:    https://codepen.io/edwardsmarkf/pen/XWBazzR
    i am creating the smart-combo-box using jScript so i will be unable to use your method until after the appendChild() is called.

    
    let element = document.createElement('smart-combo-box');
    element.value = 'my default value!';
    document.querySelector('div').appendChild(element);  // notice this needs to be done after the value is assigned.
    

    as you can see from the console screenshot, the value is successfully added to the DOM object, but the value does not display properly.

    could this possibly be a software flaw?  (a possible workaround below)

    console

    
    // 2023-01-17 workaround to smart-html-elements problem
    document.getElementById('phoneticTranscriptionInputScreen').querySelectorAll('smart-combo-box').forEach( item => {
    if ( item.value ) {
    let tmp = item.value;
    item.value = '';
    item.value = tmp;
    }
    })
    
    #104250

    Hi,

    The problem is resolved and the fixed version will come with the next release.
    Thank you for reporting the bug!

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

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