我想根据选项选择选择选项组。选项组名称为Class,类有两个选项(Class A,Class B)。如果我选择A类,B类,则自动选择选项组。假设如果我取消选择A类,则取消选择选项组。
我想选择引导功能的选择器。
我试过但没有任何暗示。请帮我解决这个问题。
提前致谢。
我已将以下行添加到项目中的bootstrap-select.js以允许此功能:find clickListener:function(){和insert
单击组标题时它将起作用
this.$newElement.find('li').on('click', function(e) {
e.preventDefault();
console.log('Bootstrap-Select.js - line #1438');
var base = $(this).closest(".bootstrap-select");
var select = base.find("select");
// check if this .dropdown-header is part of bootstrap-select AND multiple or not
if (base.length && select.prop("multiple")) {
var group = $(this).data("optgroup") - 1;
var group2 = group + 1;
var select = $(this).closest(".bootstrap-select").find("select");
if ($(this).hasClass("dropdown-header")) {
if (base.find("li[data-optgroup=" + group2 + "]:not(.selected)").length === 1)
$(this).closest(".bootstrap-select").find("select > optgroup:eq(" + group + ") > option").prop("selected", false);
else
$(this).closest(".bootstrap-select").find("select > optgroup:eq(" + group + ") > option").prop("selected", true);
select.selectpicker('render');
//select.change();
}
}
});