RadComboBox selection persisted on a postback after clearSelection() call

2 posts, 0 answers
  1. Will Lopez
    Will Lopez avatar
    4 posts
    Member since:
    Jan 2010

    Posted 29 May 2013 Link to this post

    Hello:

    Here's the scenario. user defines a search via several radcomboboxes. The form is cleared, using the following javascript to clear the comboboxes selected:

    function ResetComboBoxValue(ctrl, isDisable) {
        var combo = $find(ctrl);
        var input = combo.get_inputDomElement();
        if (combo != null) {
            combo._enabled = true;
            combo.trackChanges();
            combo.clearSelection();
            combo.set_emptyMessage(combo.get_emptyMessage());
            if (isDisable) {
                combo._enabled = false;
                input.readOnly = true;
            }
            combo.commitChanges();
        }
    }

    All that looks good until a postback is done then the previously selected values are "restored". I thought that by using the commitChanges() it would sync the client changes to the server to prevent the previous selected items from being restored. 

    Thanks!
  2. Will Lopez
    Will Lopez avatar
    4 posts
    Member since:
    Jan 2010

    Posted 29 May 2013 Link to this post

    A coworker came up with this. It works.

    function ResetRadCbChkValue(ctrl) {
        var combo = $find(ctrl);
        if (combo != null && combo._text != "") {
            var items = combo.get_checkedItems();
            combo.clearSelection();
            var i = 0;
            while (i < items.length) {
                items[i].uncheck();
                i++;
            }
            combo.set_emptyMessage(combo.get_emptyMessage());
        }
    }
Back to Top