2

在这里我有一个问题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

4

1 回答 1

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;
                    }
                }
            }
        });
于 2013-12-09T05:06:46.190 回答