我在dropdownchecklist
我想绑定dropdownchecklist
中选定的一些项目,因为我使用以下代码:
var Ids = $("#selectedIds").val();
if (Ids != "") {
// $('#AgeGroupIds1').dropdownchecklist('destroy');
$("#AgeGroupIds1").dropdownchecklist({ forceMultiple: true, width: 0 });
var statusArray = new Array();
var statusString = new String();
statusString = Ids.toString();
statusArray = statusString.split(',');
for (var i = 0; i < statusArray.length; i++) {
$("#AgeGroupIds1 option:[value='" + statusArray[i] + "']").attr('selected', 'selected');
}
}
$("#AgeGroupIds1").dropdownchecklist({
forceMultiple: true,
maxDropHeight: 190,
width: 220,
onComplete: function (selector) {
var pcids = "";
for (i = 0; i < selector.options.length; i++) {
if (selector.options[i].selected && (selector.options[i].value != "")) {
if (pcids != "") pcids += ",";
pcids += selector.options[i].value;
}
}
}
});
我们的问题是显示多个dropdownchecklist
答案 0 :(得分:0)
var Ids = $("#selectedIds").val();
if (Ids != "") {
// $('#AgeGroupIds1').dropdownchecklist('destroy');
$("#AgeGroupIds1").dropdownchecklist({ forceMultiple: true, width: 0 });
var statusArray = new Array();
var statusString = new String();
statusString = Ids.toString();
statusArray = statusString.split(',');
for (var i = 0; i < statusArray.length; i++) {
$("#AgeGroupIds1 option:[value='" + statusArray[i] + "']").attr('selected', 'selected');
}
$("#ddcl-AgeGroupIds1").css("display", "none");
}
$("#AgeGroupIds1").dropdownchecklist({
forceMultiple: true,
maxDropHeight: 190,
width: 220,
onComplete: function (selector) {
var pcids = "";
for (i = 0; i < selector.options.length; i++) {
if (selector.options[i].selected && (selector.options[i].value != "")) {
if (pcids != "") pcids += ",";
pcids += selector.options[i].value;
}
}
}
});