jQuery MiniUI

标题: CellEdit 单元格中combobox问题 [打印本页]

作者: johnconner    时间: 2012-12-13 15:45:37     标题: CellEdit 单元格中combobox问题

<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?是这个样子
[attach]1101[/attach]










作者: factory    时间: 2012-12-13 16:16:41

[
   {id:...,kind:....},
   {id:...,kind:....},
   {id:...,kind:....}
]
这样子的数据
作者: johnconner    时间: 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}]}

作者: factory    时间: 2012-12-13 16:31:21

johnconner 发表于 2012-12-13 16:27
这是Test.JSON.Encode();自动转化的格式,还需要修改吗?

combobox接受的数据需要这样结构的,你后台应该组织好了再返回
作者: johnconner    时间: 2012-12-15 10:49:25

factory 发表于 2012-12-13 16:31
combobox接受的数据需要这样结构的,你后台应该组织好了再返回

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





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