日期:2014-05-16  浏览次数:20374 次

ExtJs combobox模糊匹配
{
	xtype : 'combobox',
	fieldLabel : '选择银行',
	name : 'bankDTO.id',
	allowBlank : false,
	queryMode : 'remote',
	displayField : 'name',
	valueField : 'id',
	store : Ext.create('Ext.data.Store', {
		fields: ['id', 'name'],
		proxy : {
			type : 'ajax',
			url : getRequestPath('bank_listBank.action'),
			reader : {
				type : 'json',
				root : 'bankList'
			}
		},
		autoLoad : true
	}),
	listeners : {
		beforequery : function(e) {
			var combo = e.combo;   
			if(!e.forceAll){   
				var value = e.query;   
				combo.store.filterBy(function(record,id){   
					var text = record.get(combo.displayField);   
					return (text.indexOf(value)!=-1);   
				});
				combo.expand();   
				return false;   
			}
		}
	}
}