错误:尝试在Jquery

时间:2019-01-03 13:41:28

标签: javascript jquery asp.net combobox ajaxcontroltoolkit

我正在填充我的组合框,然后按照下面的代码示例对其进行初始化。 第一次运行时它工作得很好,但是当我尝试在选定的项目之间切换并且再次填充组合框时,出现错误  “无法读取未定义的属性'style'”。

var options = value.split(";");
for (var i = 0; i < options.length; i++) {
if (i == 0) {
    var option = document.createElement('LI');
    option.innerHTML = "--Select--";
    //option.value = "";
    option.setAttribute("value", "--Select--");
    ComboBoxCtrl._optionListControl.appendChild(option);
    continue;
}
var optn = document.createElement('LI');
optn.innerHTML = options[i];
//optn.value = options[i];
optn.setAttribute("value", options[i]);
ComboBoxCtrl._optionListControl.appendChild(optn);
}

Sys.Application.removeComponent(ComboBoxCtrl._popupBehavior);
ComboBoxCtrl.initializeOptionList();
ComboBoxCtrl.initializeButton();
ComboBoxCtrl._popupBehavior._visible = false;

我的ajaxToolkitControl版本是4.1.7.1213  

当我尝试跟踪错误时,出现以下消息

There is an error occurred: TypeError: Cannot read property 'style' of undefined
    at Sys.Extended.UI.ComboBox._highlightListItem (https://localhost/CombineScriptsHandler.ashx?_TSM_CombinedScripts_=True&v=WL_exbic68tpMKM8VhSeWzSZhMnOe7B7-INfrc8tfdg1&_TSM_Bundles_=&cdn=True:1:356098)
    at Sys.Extended.UI.ComboBox.initializeOptionList (https://localhost/CombineScriptsHandler.ashx?_TSM_CombinedScripts_=True&v=WL_exbic68tpMKM8VhSeWzSZhMnOe7B7-INfrc8tfdg1&_TSM_Bundles_=&cdn=True:1:346296)
    at InitializeComboBox (https://localhost/_layouts/Documentum/d2/D2PropertiesDialog.js:101:22)
    at Object.success (https://localhost/_layouts/Documentum/d2/D2PropertiesDialog.js:221:17)
    at c (https://localhost/_layouts/Documentum/jquery-1.10.2.min.js:4:26036)
    at Object.fireWith [as resolveWith] (https://localhost/_layouts/Documentum/jquery-1.10.2.min.js:4:26840)
    at k (https://localhost/_layouts/Documentum/jquery-1.10.2.min.js:6:14258)
    at r (https://localhost/_layouts/Documentum/jquery-1.10.2.min.js:6:18646)
    at Object.send (https://localhost/_layouts/Documentum/jquery-1.10.2.min.js:6:18771)
    at Function.ajax (https://localhost/_layouts/Documentum/jquery-1.10.2.min.js:6:13722)

0 个答案:

没有答案