jQuery MiniUI

 找回密码
 立即注册
查看: 4003|回复: 3
打印 上一主题 下一主题

miniui listbox 绑定对象 [复制链接]

Rank: 2

跳转到指定楼层
楼主
发表于 2017-5-17 09:12:10 |只看该作者 |倒序浏览
miniui listbox 如何绑定对象,有例子吗?

Rank: 8Rank: 8

沙发
发表于 2017-5-17 09:26:47 |只看该作者
mini.get(id).setData(data)   //data数组格式,内部是一个个对象[{id:1,text:"a"},{..},{},{}]

Rank: 2

板凳
发表于 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\"}"}]

Rank: 8Rank: 8

地板
发表于 2017-5-17 10:09:00 |只看该作者
Lara 发表于 2017-5-17 09:58
数据源是这样如下,data字段可以这么绑吗?
[{"ProjectId":"11","ProjectN ...

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

Archiver|普加软件

GMT+8, 2024-11-28 16:18 , Processed in 1.023618 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部