Skip to content

Commit 81fb185

Browse files
committed
Updated logic used to enable/disable scrolling in the Table.
1 parent 730bff8 commit 81fb185

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Diff for: src/table/Table.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ if(!javaxt.dhtml) javaxt.dhtml={};
55
//** Table Class
66
//******************************************************************************
77
/**
8-
* Scrollable table with fixed header. Built-in support for iScroll (just
9-
* include it - no configuration required).
8+
* Scrollable table with fixed header.
109
*
1110
******************************************************************************/
1211

@@ -409,15 +408,20 @@ javaxt.dhtml.Table = function(parent, config) {
409408
if (config.style.iscroll) setStyle(me.iScroll, "iscroll");
410409

411410

412-
me.iScroll.on('scrollStart', function(){
411+
//Override the iscroll's translate method so we can catch all
412+
//scroll movements and prevent scrolling as needed
413+
var translate = me.iScroll._translate;
414+
me.iScroll._translate = function(x, y){
415+
if (!scrollEnabled) return;
416+
translate.apply(me.iScroll, arguments);
417+
onScroll(-me.iScroll.y);
418+
};
413419

414-
if (!scrollEnabled){
415-
//Stop iscroll! Not sure how to do this but throwing an
416-
//error seems to work...
417-
throw new Error('IScroll disabled');
418-
return;
419-
}
420+
me.iScroll.on('beforeScrollStart', function(){
421+
onScroll(-me.iScroll.y);
422+
});
420423

424+
me.iScroll.on('scrollStart', function(){
421425
onScroll(-me.iScroll.y);
422426
});
423427

0 commit comments

Comments
 (0)