我有一个使用DHTMLXCombo为我的Gantt过滤器创建的组合框。但由于某些原因,当我添加附加事件时,它停止了切换。任何人都可以告诉我这里的问题是什么,非常感谢任何帮助
下面是我的代码:
HTML
<body onload="multiselect_filter()">
<select id="search_type" mode="checkbox" style="display:inline-block;">
<option value="ALL" checked="1">ALL</option><option value="ALL" checked="0">ALL</option>
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select>
</body>
Javascript:
var search_type_combobox;
var search_type_value = {'ALL': true};
//FILTER BY TYPE
function multiselect_filter(){
//SEARCH TYPE
search_type_combobox = dhtmlXComboFromSelect("search_type", "combo", 100, "checkbox");
search_type_combobox.enableFilteringMode(true);
//IT STOP TOGGLING WHEN I ATTACH THIS EVENT
search_type_combobox.attachEvent("onCheck", function(value, state){
var values = search_type_combobox.getChecked();
search_type_value = {};// put combo value into scope variable
for(var i = 0; i < values.length; i++){
search_type_value[values[i]] = true;// build hash for easy check later
console.log(i);
console.log(value);
console.log(search_type_value);
console.log(search_type_value[values[i]]);
}
gantt.render();// and repaint gantt
});
<!--Filter gantt by value of the scope variable-->
gantt.attachEvent("onBeforeTaskDisplay", function (id, task) {
if(search_type_value['ALL'])
return true;
return !!search_type_value[task.search_type];
});
}
答案 0 :(得分:0)
不幸的是,问题无法在本地重建。
如果您使用旧版本的dhtmlxCombo(&lt; 4.4),请尝试从您的onCheck事件中“返回true”。
如果您仍然可以解决问题,请分享演示链接,以便重现问题。