jQuery MiniUI

标题: miniui listbox 绑定对象 [打印本页]

作者: Lara    时间: 2017-5-17 09:12:10     标题: miniui listbox 绑定对象

miniui listbox 如何绑定对象,有例子吗?

作者: dforce    时间: 2017-5-17 09:26:47

mini.get(id).setData(data)   //data数组格式,内部是一个个对象[{id:1,text:"a"},{..},{},{}]
作者: Lara    时间: 2017-5-17 09:58:03

本帖最后由 Lara 于 2017-5-17 09:59 编辑

<div id="listbox1" class="mini-listbox" style="width:150px;height:150px;"
                                 textfield="ProjectName" valuefield="ProjectId" data="Tag" showcheckbox="true" multiselect="true">
                            </div>

数据源是这样如下,data字段可以这么绑吗?
[{"ProjectId":"11","ProjectName":"项目一","ReceiverId":2,"ReceiverName":"pmis","DeptId":37087,"DeptName":"学校","InnerAuditUserId":2,"InnerAuditUserName":"pmis","Tag":"{\"ProjectId\":\"11\",\"ProjectName\":\"项目一\",\"ReceiverId\":2,\"ReceiverName\":\"pmis\",\"DeptId\":37087,\"DeptName\":\"学校\",\"InnerAuditUserId\":2,\"InnerAuditUserName\":\"pmis\"}"},{"ProjectId":"12","ProjectName":"项目二","ReceiverId":2,"ReceiverName":"pmis","DeptId":37087,"DeptName":"学校","InnerAuditUserId":2,"InnerAuditUserName":"pmis","Tag":"{\"ProjectId\":\"12\",\"ProjectName\":\"项目二\",\"ReceiverId\":2,\"ReceiverName\":\"pmis\",\"DeptId\":37087,\"DeptName\":\"学校\",\"InnerAuditUserId\":2,\"InnerAuditUserName\":\"pmis\"}"}]
作者: dforce    时间: 2017-5-17 10:09:00

Lara 发表于 2017-5-17 09:58
数据源是这样如下,data字段可以这么绑吗?
[{"ProjectId":"11","ProjectN ...

数据不对
首先你tag下的数据不是数组,只是一个字符串
其次你的tag不是一个变量,是data.tag




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2