jquery - 如何使用 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>
我在哪里做错了
当我向下滚动复选框时自动取消选中。
解决方案
推荐阅读
- generics - 为什么嵌套数组元素类型的推理失败?
- c# - 控制台应用程序崩溃,未执行全局 try catch 和 UnhandledException
- python - 如何使 IBM Watson Assistant 欢迎节点开始与 Node.js 或 Python 的对话?
- laravel - 从 Laravel 中 API 的一对多关系表中获取数据
- python - 将多种算法与 sklearn 管道进行比较
- php - 如何让 PHP 脚本作为 img 源工作?
- python - 遍历列表,直到其长度的百分比 - Python
- python - Tkinter 逐步执行失败并显示“之后”
- javascript - React Apollo 客户端的 Mutation 组件中的 refetchQueries 不起作用?
- javascript - 排序数字,但在 UL 中的 HTML