jQuery UI Widgets Forums Lists ComboBox create combobox programatically?

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 9 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • create combobox programatically? #63180

    morgenweck
    Participant

    Is it possible to built multiple comboboxes at runtime programatically? I’m doing:
    var root = document.getElementById(‘root’);
    var selectLength = document.getElementsByTagName(‘select’).length;
    var selectlist = document.createElement(‘select’);
    selectlist.id = “select” + selectLength;
    selectlist.onclick = ‘alert();’;

    var ops = new Array(“first”, “second”, “thrid”, “fourth”, “fifth”);
    for (var i = 0; i < ops.length; i++) {
    var o = document.createElement(“option”);
    var t = document.createTextNode(ops[i]);
    o.setAttribute(“value”, ops[i]);
    o.appendChild(t);
    selectlist.appendChild(o);
    }
    root.appendChild(selectlist);

    And need the ability to add multiple jqxComboBox comboboxes. I may need to create 10 or more boxes based upon the selected value of the prior selected value, can this be done using jqxComboBox?

    Thanks

    • This topic was modified 9 years, 7 months ago by  morgenweck.
    create combobox programatically? #63193

    Dimitar
    Participant

    Hello morgenweck,

    This can be achieved. You would have to dynamically call the comboboxes’ initialization code after the respective select elements have been appended to the document. E.g., call the following line after the code you posted:

    $("#" + selectlist.id).jqxComboBox({ width: 300, height: 25 });

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.