当前位置: 代码迷 >> Ajax >> Extjs combobox 数据远程调用有关问题,求帮助
  详细解决方案

Extjs combobox 数据远程调用有关问题,求帮助

热度:1003   发布时间:2013-03-06 16:20:31.0
Extjs combobox 数据远程调用问题,求帮助
先上代码:
var roleStore=Ext.create('Ext.data.ArrayStore',{
 fields:[
         'id','name'
         ],
 proxy:{
 url:"<{:U('Role/showArrayData')}>",
 type:'ajax',
 }
 })


下面是grid中的一部分,
{
     header:'role',
     dataIndex:'role',
     editor:new Ext.form.field.ComboBox({
                typeAhead: true,
                triggerAction: 'all',
                selectOnTab: true,
                store:roleStore,
                lazyRender: true,
                listClass: 'x-combo-list-small'
            })
 
 }

显示不出来下拉框,
json返回数据如下
[

    {
        "id": "2",
        "name": "副站长"
    },
    {
        "id": "3",
        "name": "编辑"
    }

]

显示不出下拉框,怎么改,求帮助

------解决方案--------------------
{
    header:'role',
    dataIndex:'role',
    editor:new?Ext.form.field.ComboBox({
        typeAhead:?true,
        triggerAction:?'all',
        selectOnTab:?true,
        store:roleStore,
        lazyRender:?true,
        displayField: 'name', //
        valueField: 'id',     //加上这两个
        listClass:?'x-combo-list-small'
    })
}

------解决方案--------------------
{
xtype: 'gridcolumn',
dataIndex: 'role',
editor: {
xtype: 'combobox',
displayField:'name',
valueField: 'id',
store:roleStore
}
}

类似这样的
  相关解决方案