jQuery UI Widgets Forums Lists ComboBox programmatically checking checkboxes

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • programmatically checking checkboxes #52912

    morgenweck
    Participant

    I have a combobox created using

    var values = new Array(“A”, “B”, “C”, “D”)
    $(“#jqxComboBoxFundCategory”).jqxComboBox({ source: values, checkboxes: true, width: 250, height: 25 });

    and I save the data with

    $(“#jqxComboBoxFundCategory”).on(‘close’, function (event) {
    if (event.args) {
    var item = event.args.item;
    if (item) {

    var items = $(“#jqxComboBoxFundCategory”).jqxComboBox(‘getCheckedItems’);
    var checkedItems = “”;
    $.each(items, function (index) {
    checkedItems += this.label + “, “;
    });

    }
    save_combo_values(‘FundCategory’, checkedItems);
    }
    });
    The data is in the database fine.

    When I try to load the data back I use,

    var FundCategory = “A,C”

    var str_array = FundCategory.split(‘,’);

    for (var i = 0; i < str_array.length; i++) {
    // Trim the excess whitespace.
    str_array[i] = str_array[i].replace(/^\s*/, “”).replace(/\s*$/, “”);
    // Add additional code here, such as:
    $(“#jqxComboBoxFundCategory”).jqxComboBox(‘selectItem’, str_array[i]);
    }

    Nothing get populated. What am I doing wrong?

    Thanks

    programmatically checking checkboxes #52921

    Peter Stoev
    Keymaster

    Hi morgenweck,

    “checkItem” should be used for checking a ComboBox item. Example: http://jsfiddle.net/jqwidgets/VvXsa/

    Hope this helps.

    Best Regards,
    Peter Stoev

    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.