PDA

View Full Version : How to relay a body scroll



Yemi
20 Aug 2013, 2:41 AM
I have a class defined like below with a body scroll listener, how do I relay this bodyscroll listener to a class that will implement this grid:


MyGridPanel=Ext.extend (file:///E:/ext-3.4.1.1-gpl/ext-3.4.1/docs/index.html#!/api/Ext-method-extend)(Ext.grid.GridPanel (file:///E:/ext-3.4.1.1-gpl/ext-3.4.1/docs/index.html#!/api/Ext.grid.GridPanel),{
constructor:function(config){//
Create configuration for this Grid.
var store =newExt.data.Store (file:///E:/ext-3.4.1.1-gpl/ext-3.4.1/docs/index.html#!/api/Ext.data.Store)({...});
var colModel =newExt.grid.ColumnModel (file:///E:/ext-3.4.1.1-gpl/ext-3.4.1/docs/index.html#!/api/Ext.grid.ColumnModel)({...});
// Create a new config object containing our computed properties// *plus* whatever was in the config parameter.
config =Ext.apply (file:///E:/ext-3.4.1.1-gpl/ext-3.4.1/docs/index.html#!/api/Ext-method-apply)({ store: store,
colModel: colModel,
listeners: { 'bodyScroll': function (scrollLeft, scrollTop){



}
}
}, config);MyGridPanel.superclass.constructor.call(this, config);// Your postprocessing here
this.relayEvents(['bodyScroll']); },
yourMethod:function(){// etc.} });

Yemi
20 Aug 2013, 6:56 AM
Any Ideas please

slemmon
22 Aug 2013, 9:01 AM
If you're wanting to have component B listen to component A's events you can relay the events from A to B using relayEvents:
http://docs-origin.sencha.com/extjs/3.4.0/#!/api/Ext.grid.GridPanel-method-relayEvents

gridB.relayEvents(gridA, ['bodyscroll']);

Then you can add a bodyscroll event listener to gridB which will be called when gridA's bodyscroll event is fired.