不少朋友用 extjs 不少时候都要用到combo 而异步加载是用的最多的 今天我就举一个例子 了解combo的异步加载异步
Ext.onReady(function () { url
Ext.BLANK_IMAGE_URL = "/Scripts/resoures/images/default/s.gif"; orm
var sotre = new Ext.data.JsonStore({ ip
autoLoad: true, rem
proxy: new Ext.data.HttpProxy({ url: 'Text.aspx' }), get
reader: new Ext.data.JsonReader({ fields: [{ name: 'id' }, { name: 'peovince'}], it
root: 'root' }) }); io
var form = new Ext.form.FormPanel({ table
frame: true, function
border: true,
width: 300,
height: 200,
renderTo: Ext.getBody(),
items: [{
xtype: 'combo',
id: 'com',
fieldLabel: '书籍列表',
store: sotre, //设置数据源
displayField: 'peovince',
valueField: 'id',
mode: 'remote',
triggerAction: 'all',
selectOnFocus: true,
allowBlank: false,
editable: false }]
});
});
注意加载的时候 要注意设置加载模式 本地仍是异步 已经设置 autoLoad: true, 这个属性 很重要