Hi Derell,
thanks a lot for your prompt answer. I tried it by using an own private
instance variable in the subclass for "__ignoreClick", and it works good
(source is attached), but this solves the problem by invoking a new one: now
my implementation accesses the private instance variable
"this.__resizeColumn" from the superclass.
And this instance variable is unfortunately used at several places in the
superclass, so I would have to reimplement all those methods, too, and maybe
there are yet other private instance variables that are used in those new
methods... leading to have the source code of many methods redundant?
Regards
Michael
qx.Class.define("hello.TgridScroller",
{
extend : qx.ui.table.pane.Scroller,
construct : function(table) {
this.base(arguments, table);
},
members: {
__tgridIgnoreClick : false,
/**
* Overwrites the onMouseup
*
* because the private variable "__tgridIgnoreClick" cannot be used in
the
* subclass.
*/
_onMouseupHeader : function(e) {
var table = this.getTable();
if (! table.getEnabled()) {
return;
}
if (this.__resizeColumn != null) {
this.__tgridIgnoreClick = true;
// Let the superclass do the logic from here on, we have set our
variable:
this.base(arguments, e);
} else if (this.__moveColumn != null) {
// Let the superclass do the logic from here on, we have set our
variable:
this.base(arguments, e);
}
},
/**
* Overwrites the onClick
*
* because T-GRID allows filters (textfields, dropdowns etc...) in the
header of
* a table, therefore, the onClick event must be able to determine
whether the
* user clicked inside the background of the header (to sort it or to
move the
* column) or inside one of the filter widgets.
*
* @param e {Map} the event.
* @return {void}
*/
_onClickHeader : function(e) {
if (this.__tgridIgnoreClick) {
this.__tgridIgnoreClick = false;
return;
}
var table = this.getTable();
if (!table.getEnabled()) {
return;
}
var tableModel = table.getTableModel();
var doSort = false;
var pageX = e.getDocumentLeft();
var resizeCol = this._getResizeColumnForPageX(pageX);
if (resizeCol == -1) {
// mouse is not in a resize region
var col = this._getColumnForPageX(pageX);
if (col != null && tableModel.isColumnSortable(col)) {
// Normally the column should be sorted now, but we should check
whether the
// header widget is one of our own. If yes, it could be that the
user clicked
// on a widget or our filter. In this case, we should not sort it,
but pass
// the event on.
doSort = true;
var headerWidget = this.getHeader().getHeaderWidgetAtColumn(col);
if (headerWidget) {
// Is it one of my own header widgets? I know that I defined a
member method
// called "isInFilterArea", if this one is defined I can
actually invoke it.
if (headerWidget.isInFilterArea) {
var pageY = e.getDocumentTop();
if (headerWidget.isInFilterArea(pageX, pageY)) {
doSort = false;
}
}
}
}
}
if (doSort) {
// Let the superclass do the sorting:
this.base(arguments, e);
}
e.stop();
}
}
});
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/Subclassing-Scroller-js-tp5030157p5030609.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel