jQuery MiniUI

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

CellEdit 单元格中combobox问题 [复制链接]

Rank: 3Rank: 3

跳转到指定楼层
楼主
发表于 2012-12-13 15:45:37 |只看该作者 |倒序浏览
<div field="sbkind" type="comboboxcolumn" autoShowPopup="true" width="150" allowSort="true"  align="center" headerAlign="center" vtype="required">设备种类
                <input property="editor" class="mini-combobox" style="width:100%;" textField="kind" valueField="id" url="sbname.ashx?method=getsbkinds"/>
            </div>


返回数据是:
{"data":[{"id":1,"kind":"压力类"},
{"id":2,"kind":"温度类"},
{"id":3,"kind":"变送器类"},
{"id":4,"kind":"热电阻类"},
{"id":5,"kind":"调节阀类"},
{"id":6,"kind":"流量计类"},
{"id":7,"kind":"热量表类"},
{"id":8,"kind":"变频柜类"},
{"id":9,"kind":"PLC柜类"},
{"id":10,"kind":"UPS柜类"}]}

为什么数据无法绑定到combobox?是这个样子










附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册

Rank: 8Rank: 8

沙发
发表于 2012-12-13 16:16:41 |只看该作者
[
   {id:...,kind:....},
   {id:...,kind:....},
   {id:...,kind:....}
]
这样子的数据

Rank: 3Rank: 3

板凳
发表于 2012-12-13 16:27:28 |只看该作者
本帖最后由 johnconner 于 2012-12-13 16:42 编辑
factory 发表于 2012-12-13 16:16
[
   {id:...,kind:....},
   {id:...,kind:....},


这是Test.JSON.Encode();自动转化的格式,还需要修改吗?
我查看了一下,Test.JSON.Encode();转换出来的都是这种格式

{"total":24,"data":[
{"sbname":"压力表","del":1,"sbkind":2,"id":1},
{"sbname":"2","del":1,"sbkind":1,"id":2},
{"sbname":"3","del":1,"sbkind":1,"id":3},
{"sbname":"4","del":1,"sbkind":1,"id":4},
{"sbname":"5","del":1,"sbkind":1,"id":5},
{"sbname":"6","del":1,"sbkind":1,"id":6},
{"sbname":"7","del":1,"sbkind":1,"id":7},
{"sbname":"8","del":1,"sbkind":1,"id":8},
{"sbname":"9","del":1,"sbkind":1,"id":9},
{"sbname":"10","del":1,"sbkind":1,"id":10}]}

Rank: 8Rank: 8

地板
发表于 2012-12-13 16:31:21 |只看该作者
johnconner 发表于 2012-12-13 16:27
这是Test.JSON.Encode();自动转化的格式,还需要修改吗?

combobox接受的数据需要这样结构的,你后台应该组织好了再返回

Rank: 3Rank: 3

5#
发表于 2012-12-15 10:49:25 |只看该作者
factory 发表于 2012-12-13 16:31
combobox接受的数据需要这样结构的,你后台应该组织好了再返回

终于实验出来了,与""没什么关系,只是{"total":24,"data":和最后面的},去掉就OK,id和kind带不带引号都行。

Archiver|普加软件

GMT+8, 2024-11-27 11:54 , Processed in 1.042758 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部