【问题标题】:jqGrid - add Checkbox in toolbar dropdownjqGrid - 在工具栏下拉列表中添加复选框
【发布时间】:2016-09-29 08:55:42
【问题描述】:
我正在尝试在 jqGrid 工具栏的下拉列表中添加复选框,但我无法弄清楚如何去做。我有一个工作正常的多选框,但我想用下拉列表中可见的复选框替换它。
我的代码是
{
name: 'Status',
index: 'account.status',
searchoptions: {
sopt: ['eq'],
value: ":All;0:Pending;1:Warming;2:Running;3:Dead;4:ID Verification",
multiple: true
},
stype: 'select'
}
jqGrid js 版本 5.1.1
我还附上了截图以便更好地理解。
这就是我所拥有的
这就是我需要的
任何建议都会对我很有帮助。
提前致谢。
【问题讨论】:
标签:
jquery
checkbox
jqgrid
jqgrid-php
【解决方案1】:
您可以使用ui.multiselect 实现带有复选框的下拉菜单。
包括这 2 个文件
<link rel="stylesheet" type="text/css" href="path/to/your/ui.multiselect.css" />
<script src="path/to/your/jquery-ui.min.js" type="text/javascript"></script>
然后试试这段代码。
{
name: 'Status',
index: 'account.status',
stype: 'select',
searchoptions: {
sopt: ['eq'],
value: ":All;0:Pending;1:Warming;2:Running;3:Dead;4:ID Verification",
multiple: true,
dataInit: function(e){
$(e).multiselect({
minWidth: 120,
selectedList: 2,
noneSelectedText: "Any"
});
}
}
}