关于easyUI的combbobox下拉框多选时,后台获取下拉框的值获取的问题
来源:互联网 发布:hf线切割编程软件8.0 编辑:程序博客网 时间:2024/05/21 22:39
在使用easyUI的combobox时,当参数里设置为multiple:true时,下拉框可以选择多个,
设定多选的combox的值时,
使得combobox自带复选框功能则可以使用以下代码:
js代码
<pre name="code" class="javascript">$('#cc').combobox({ panelHeight:'auto', multiple:true,method:'get',url:'web',dataType : "json",valueField:'id',textField:'name', });
前台html代码:
<input name = "catalog_id" id="cc" />
多选时,值的获取不是一个String了,是一个String[] 的数组了,此时后台获取应该是
String[] catalog_id = req.getParameterValues("catalog_id");
设定多选的combox的值时,
$('#cc').combobox('setValues','value1','value2');
使得combobox自带复选框功能则可以使用以下代码:
$('#cc').combobox({ url:'combobox_data1.json', method:'get', valueField:'id', textField:'text', panelHeight:'auto', multiple:true, formatter: function (row) { var opts = $(this).combobox('options'); return '<input type="checkbox" class="combobox-checkbox">' + row[opts.textField] }, onLoadSuccess: function () { var opts = $(this).combobox('options'); var target = this; var values = $(target).combobox('getValues'); $.map(values, function (value) { var el = opts.finder.getEl(target, value); el.find('input.combobox-checkbox')._propAttr('checked', true); }) }, onSelect: function (row) { //console.log(row); var opts = $(this).combobox('options'); var el = opts.finder.getEl(this, row[opts.valueField]); el.find('input.combobox-checkbox')._propAttr('checked', true); }, onUnselect: function (row) { var opts = $(this).combobox('options'); var el = opts.finder.getEl(this, row[opts.valueField]); el.find('input.combobox-checkbox')._propAttr('checked', false); } });
0 0
- 关于easyUI的combbobox下拉框多选时,后台获取下拉框的值获取的问题
- easyui 获取下拉框的值
- easyUI(六) -- combobox实现下拉框及其值的获取
- js中easyUI 中的下拉框的值获取方式
- angularjs 动态从后台获取下拉框的值
- 获取下拉框的值
- 获取下拉框的值
- 获取下拉框的值
- jquery easyui中获取下拉列表的值
- select获取下拉框的值 下拉框默认选中
- 获取时间的下拉框:
- 获取下拉列表的值
- 获取下拉选的值
- Jquery获取下拉框被选中的value值,并传到后台,然后后台回显到界面
- easyUI下拉框控件easyui-combobox使用后台json文件填充数据失败的问题
- 怎样获取下拉列表框的值
- Js获取下拉框的文本值
- js获取下拉框的值
- BroadcastShardOperationFailedException TooManyClauses[maxClauseCount is set to
- C++中string的函数使用
- leetcode-13 Roman to Integer
- C++中关于get()和getline()函数读取行的问题
- BroadcastShardOperationFailedException[[vnvoos1.html][4] ]; nested: RemoteTransp
- 关于easyUI的combbobox下拉框多选时,后台获取下拉框的值获取的问题
- [Elasticsearch] 分布式搜索
- 关于编译时候的问题
- es Synonyms filter
- 转型操作工具类
- [leetcode] 272. Closest Binary Search Tree Value II 解题报告
- HBase笔记
- CSS之文本
- Lucene 同义词