extjs 下拉框,远程数据获取 例子
hiJerry 提问于:2018-07-28
0 0

求,extjs远程获取comb数据,实例

  • 所有回答
baibai 回答于:2018-08-06
0 0

JS

var extjs_combox_store = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url: '../commonUtil/getProvices.htm'}),
        reader: new Ext.data.JsonReader({}, [
            {name: 'key', type: 'string', mapping: 'key'},
            {name: 'name', type: 'string', mapping: 'name'}
        ]),
        autoLoad: true,
        listeners: {
        load: function (store, record, opts) {
            }
        }
    });

    //下拉
    var  extjs_combox = new Ext.form.ComboBox({
          fieldLabel : "省",
          store: extjs_combox_store,
          displayField: 'key',
          valueField: 'name',
          width: 200,
          mode: 'local',
          triggerAction: 'all',
          emptyText: '请选择省',
          editable: false,
          listeners: {
            select: function(combo, record, index) {
            }
          }
    });

后台需要返回前端数据

[{"name":"河北省","key":10001}]
我来回答    extjs 下拉框,远程数据获取 例子