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

Extjs 控制组件滚动条事件(二)

给dataview添加自定义滚动条事件

?

DataViewUi== Ext.extend(Ext.DataView,{
    id:'dataview',
    title:'dataview',
    store:dataviewStore,
    tpl:tpl,
    initComponent:function(){
		DataViewUi.superclass.initComponent.call(this);
		this.addEvents(
			'bodyscroll'
		);
		this.on('afterrender',this.onAfterRender,this);
	},
	onAfterRender:function(view){
		var el = view.getEl().up('div');
		el.on('scroll',this.scrollHandle,this);
	},
	scrollHandle:function(e,t,o){
		this.fireEvent('bodyscroll',e,t,o);
	}
});


DataView = Ext.extend(DataViewUi,{
    initComponent:function(){
		DataView.superclass.initComponent.call(this);
		this.on('bodyscroll',this.handleScroll,this);
	},
	handleScroll:function(e,t,o){
		//alert('s');
		//此处对dataview的滚动条事件进行处理
	}
});

?