转贴自:http://hi.baidu.com/kaka888/blog/item/820ffddc7b64bba5cd1166fe.html
//布种 直接从数据库读去数据生成列表
var fabircTypeDs = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: CONTEXT_PATH+'/fabrictype/fabrictypeAll.action'
}),
reader: selReader,
remoteSort: false
});
fabircTypeDs.load();
var fabircTypeCmb = new Ext.form.ComboBox({
fieldLabel: '布种',
store: fabircTypeDs,
hiddenName:'softId',
loadingText: 'searching...',
displayField : 'name',
mode:'local',
editable : false,
valueField: 'id',
width: 170,
triggerAction: 'all'
});
//供应商 当用户输入数据时根据输入信息进行模糊查询,动态生成列表,类似google搜索框
var dsSupplier = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url:CONTEXT_PATH+'/supplier/supplierAll.action'
}),
reader: new Ext.data.JsonReader({
root: 'gridRows',
totalProperty: 'totalCount'
}, [
{name: 'id', mapping: 'id'},
{name: 'name', mapping: 'name'}
])
});
var supplierCmb = new Ext.form.ComboBox({
fieldLabel:'供应商',
store: dsSupplier,
displayField:'name',
valueField: 'id',
typeAhead: true,
loadingText: 'loading...',
width: 170,
hiddenName:'name',
hideTrigger:true,
minChars:1,
forceSelection:true,
triggerAction: 'all'
});