Extjs加车自动查找

写一个map映射值

 

var map = new Ext.KeyMap(document, {
	    key: Ext.EventObject.ENTER,
	    fn: function(){this.doSearch();},
	    scope: this
	});

 查询方法

 

 

function doSearch() {
		//查询操作
		var policyDefineName = Ext.getCmp('policyDefineName').getValue();
		var policyDefineCode = Ext.getCmp('policyDefineCode').getValue();
		
		Ext.getCmp("centerGridPanel").store.on('beforeload',function(){
			Ext.getCmp("centerGridPanel").store.baseParams = {'policyDefineName':policyDefineName,'policyDefineCode' : policyDefineCode};
		});	
		Ext.getCmp('centerGridPanel').getStore().load({params:{start:0, limit:10}});
	}

 按钮调用方法

 

keys:map,这个是映射上面的map值。

 

{text : '查询',iconCls : 'query',handler : this.doSearch,keys:map}

 

 这下面是徐大师写的,(第二种方法)

//因textarea换行会导致grid中选中取消;根据规则id,一览grid重新选中;
	var grid = Ext.getCmp("centerGridPanel");
	var idIndex = grid.store.find('scheduleId',Ext.getCmp("add-scheduleId").getValue());
    grid.getSelectionModel().selectRow(idIndex,true); 

 

你可能感兴趣的:(ExtJs)