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

ExtJs的扩展例子
Ext.ux.combo.MyComboBox = Ext.extend(Ext.form.ComboBox, {
    xtype: 'combo',
    fieldLabel: 'myCombo',
    anchor: '90%',
    valueField:"id",
    displayField:'text',
    
    typeAhead: true, 		//自动补全
    minChars : 1, 		//输入一个字符就激活
    queryParam: 'name', 	//查询字符
    width:150,
    editable: true,
    mode: 'remote',
    forceSelection: true, 	//限定选中的值为列表中的值
    triggerAction: 'all', 	//每次下拉均显示查询选项
    emptyText:'请选择',
    blankText:'请选择',    
    selectOnFocus:true, 	//用户只能选择值
    
    minListWidth: 240, 		//分页宽度
    pageSize:10,		//每页条数
    store: new Ext.data.JsonStore({
		    url: 'testAction!getXXX.action',
		    autoLoad:true,
		    root: 'root',
			totalPropety: 'total',
		    idProperty: 'id',
		    baseParams : {
	            name: ''
	        },
	    	fields: ['text', 'value']
	}),
	
    initComponent: function() {
        Ext.ux.combo.MyComboBox.superclass.initComponent.call(this);
    }
});

Ext.reg('myCombo', Ext.ux.combo.MyComboBox);