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

Extjs4 查询条件分页解决办法

? ? ? ? ? ? 只明白Extjs有自带的分页控件,却没有测试过带查询条件点下一页时条件消失的问题。在创建store后每次自动加载前都需要获取查询条件,这样问题就解决了。

var abStore = Ext.create('Ext.data.Store', {
				autoLoad : {
					start : 0,
					limit : itemsPerPage
				},
				pageSize : itemsPerPage,
				model : 'test',
				autoLoad : true,
				proxy : {
					type : 'ajax',
					url : path + '***',
					reader : {
						type : 'json',
						root : 'rows',
						totalProperty : 'results',
						idProperty : '**'
					}
				}
			});

	//解决查询条件分页问题		
	abStore.on('beforeload', function(store, options) {
			         
				var apply = Ext.getCmp('applytime').getValue();
				var end2 = Ext.getCmp('endtime').getValue();
				var start = Ext.util.Format.date(apply, 'Y-m-d');
				var stop = Ext.util.Format.date(end2, 'Y-m-d');
	
		var new_params = {
				applytime : start,
				endtime : stop
						};
		Ext.apply(store.proxy.extraParams, new_params);
		});

?

?