2017-04-13 6 views
0

私はスクロールバーを持つExtJSのグリッドパネルを持っています。私はユーザーがいつもスクロールしたことを検出しようとしているので(バーをもう動かすことはできません)これまではスクロールバーがどこにあるかを検出するが、スクロールバーがどこにあるかについての情報(?)は提供していない。ExtJSグリッドパネルのスクロールイベントですか?

//bufferedGrid is a grid panel 
this.randomGrid.getView().on('scroll', this.onRandomGridScroll, this); 
. 
. 
. 
onRandomGridScroll : function(e, t) 
{ 
    console.log(e); 
    console.log(t); 

} 

いずれのポインタもわかります。ありがとう!

+0

あなたはバッファリンググリッドのExt.grid.plugin.BufferedRendererクラスのonViewScrollを()をオーバーライドする必要があります。 – Tejas

+0

@ Tejas1991 "bufferedGrid"はちょうど名前です...プラグインを参照していません – Pepria

+0

バッファ付きグリッド(ページ区切りグリッド)を使用していますか?だから私は言っているか、またはこのグリッドのスクロールイベントをバインドする必要がある同じメソッドをオーバーライドする必要があります....あなたは大丈夫ですか? – Tejas

答えて

0

次のように(Firefoxで作品ではなく、クローム)現在のスクロールバーの位置(スクロールバーの実際、上)と最大スクロール位置にアクセスすることができます。

onBufferedGridScroll : function(e, t) 
    { 
     var max = this.bufferedGrid.getView().el.dom.scrollTopMax; 
     var current = this.bufferedGrid.getView().el.dom.scrollTop; 
     if(current == max) 
      alert('You have reached the bottom of the scroll !'); 
    } 
0

は、上のイベントを追加します。 init グリッドが描画された後、mouseupイベントとwheel downイベントを追加します。

'container #gridId':{ afterrender: this.addScrollEventListener }

addScrollEventListener: function(comp){ 
    comp.getTargetEl().on('mouseup', function(e, t) { 
     var height = comp.getTargetEl().getHeight(); 
     if (height + t.scrollTop >= t.scrollHeight) { 

     } 
    }); 
    comp.getTargetEl().on('wheeldown', function(e, t) { 
     var height = comp.getTargetEl().getHeight(); 
     if (height + t.scrollTop >= t.scrollHeight) { 

     } 
    }); 
} 
関連する問題