获取 RadComboBox 客户端旧的勾选项

Get RadComboBox client side old checked items

我的页面上有一个多选的 telerik RadComboBox 组件。我正在使用 "OnClientDropDownClosed" 客户端事件。我 post 手动返回,而不是自动返回。我想要的是,当下拉菜单关闭时,我想将旧的选中项目与客户端的新选中项目进行比较。如何通过javascript获取旧的托运项目和新的托运项目?

我找到了解决方案。我保留旧的选定 IdList。在rad组合框关闭功能上,我比较了两个列表。

var oldSelectedIdList = [];

function radComboBoxSelectedIdList() {
            var selectedIdList = [];
            var combo = $find("<%= RadComboBox.ClientID %>");
            var items = combo.get_items();
            var checkedIndices = items._parent._checkedIndices;
            var checkedIndicesCount= checkedIndices.length;
        for (var itemIndex = 0; itemIndex < checkedIndicesCount; itemIndex++){
            var item = items.getItem(checkedIndices[itemIndex]);
            selectedIdList.push(item._properties._data.value);
        }
        return selectedIdList;
    }

    $(document).ready(function () {
        oldSelectedIdList = radComboBoxSelectedIdList();
    });

    function areThereAnyChangesAtTheSelection()
    {
        var selectedIdList = radComboBoxSelectedIdList();
        var isTheCountOfEachSelectionEqual = (selectedIdList.length == oldSelectedIdList.length);
        if(isTheCountOfEachSelectionEqual == false)
            return true;

        var oldIdListMINUSNewIdList = $(oldSelectedIdList).not(selectedIdList).get();
        var newIdListMINUSOldIdList= $(selectedIdList).not(oldSelectedIdList).get();

        if (oldIdListMINUSNewIdList.length != 0 || newIdListMINUSOldIdList.length != 0)
            return true;

        return false;
    }

    function onRadComboBoxClosed(sender, args) {
        if (areThereAnyChangesAtTheSelection())
             //Your Code Here
    }