首页 > 解决方案 > 如何使用 jQuery 设置 checkListBox 值

问题描述

我在这个控件中使用 Devex Dropdown Edit,使用 ASPxListBox 进行多项选择,我想使用 Jquery 在编辑按钮上设置列表框值。复选框被选中,但在向上或向下滚动时将其清除。如何解决此问题

阿贾克斯

function OnSuccessRecordCall(data, status) {
                result = Record;
                // $("[id$='checkListBox']").append($("<option>").val("0").text("Select"));
                if (result != undefined && result.length > 0) {
                    var TotalItemCount = checkListBox.itemsValue.length
                    checkListBox.UnselectAll();
                    for (i = 0; i < TotalItemCount; i++) {
                        var item = [];
                        item = checkListBox.GetItem(i);
                        //checkListBox.UnselectAll();
                        for (var j = 0; j < result.length; j++) {
                            if (item.value == $.trim(result[j].PLANT_CODE_EDIT)) {
                                checkComboBox.ShowDropDown();
                                var Index = item.index;
                                checkListBox.SetCheckBoxChecked(Index, true); //using this property to set selected items//
                            }
                        }
                    }
                }
            }

ASPX 下拉编辑

    <dx:ASPxDropDownEdit ClientInstanceName="checkComboBox" CssClass="select"
            ID="ASPxDropDownEdit1" Width="200px" runat="server" AnimationType="None">
            <DropDownWindowStyle BackColor="#EDEDED" />
               <DropDownWindowTemplate>
                 <dx:ASPxListBox Width="100%" ID="listBox"
 ClientInstanceName="checkListBox" SelectionMode="CheckColumn" runat="server" Height="200" EnableSelectAll="true">
 <FilteringSettings ShowSearchUI="true" />
 <Border BorderStyle="None" />  
                                                                      <BorderBottom BorderStyle="Solid" BorderWidth="1px" BorderColor="#DCDCDC" />
                <Items></Items><ClientSideEvents SelectedIndexChanged="updateText" Init="updateText" />
                 </dx:ASPxListBox>
                   <table style="width: 100%">
                      <tr>
                      <td style="padding: 4px">
                <dx:ASPxButton ID="ASPxButton1" AutoPostBack="False" runat="server" Text="Close" Style="float: right">
<ClientSideEvents Click="function(s, e){ checkComboBox.HideDropDown(); }" />
                </dx:ASPxButton>
              </td>
            </tr>
         </table>
       </DropDownWindowTemplate>
       <ClientSideEvents TextChanged="synchronizeListBoxValues" DropDown="synchronizeListBoxValues" />
              </dx:ASPxDropDownEdit>

我在哪里做错了

当我向下滚动复选框时自动取消选中。

在此处输入图像描述

标签: jquery

解决方案


推荐阅读