On Mon, May 10, 2010 at 07:52, Michael Saladin <[email protected]> wrote:

> Hi all,
>
> I'm quite new to qooxdoo and I'd like to create a table that contains
> filters in the header cells (where you can narrow the results, something
> very similar to qx.ui.table.model.Filtered, for each column. E.g. when you
> have a column with dates, you have a filter in the header column that let's
> you define from-until, and when you have a String, it let's you define a
> REGEX, and when the column contains an enumeration of values, a dropdown
> menu shows all possibilities).
>
> This works great, I can provide my own custom header cell renderer and this
> renderer returns my own widgets which are then displayed in the header
> cells.
>

You may be quite new to qooxdoo, but you've already dived deep into the
qooxdoo source code and from what you've described, I can tell that you've
learned a LOT.


> I can do this by subclassing the qx.ui.table.pane.Scroller class, and by
> overwriting the _onMouseupHeader method. That works great. The problem is
> that when I overwrite the _onMouseupHeader, I need to access private members
> of the Scroller (e.g. "__ignoreClick"), but there is no setter or getter for
> this member in the Scroller implementation. It seems to work just fine, even
> when I use "generate.py build", but I think it's not the best way to change
> a private member of a superclass in a subclass.
>
> One workaround is that I copy&paste the whole source code of
> qx.ui.table.pane.Scroller and create my own version (MyScroller) and do the
> change in there. I don't like this workaround because it prevents me to
> update to a future version of qooxdoo.
>
> Another workaround would be when there would be a getter-/setter method for
> the private member "__ignoreClick". That would work, but the solution would
> only be a special solution to my current problem and would not resolve it in
> a generic way.
>
> Any other ideas?
>

You were on the right track, overriding _onMouseupHeader(). You'll notice
that the __ignoreClick member is only used in _onMouseupHeader() and in
_onClickHeader(). So all you have to do is override both methods, and
provide your own local __ignoreClick member (or, better yet, to avoid
confusion, use a different name) in your subclass. Something like this
should work for you:

qx.Class.define("custom.Scroller",
{
  extend : qx.ui.table.pane.Scroller,

  members :
  {
    __myIgnoreClick : false,

    _onMouseupHeader : function(e)
    {
      var table = this.getTable();

      if (! table.getEnabled()) {
        return;
      }

      if (this.__resizeColumn != null)
      {
        this._stopResizeHeader();
        this.__myIgnoreClick = true;
        e.stop();
      }
      else if (this.__moveColumn != null)
      {
        this._stopMoveHeader();
        e.stop();
      }
    },


    _onClickHeader(e)
    {
      if (this.__myIgnoreClick)
      {
        this.__myIgnoreClick = false;
        return;
      }

      this.base(arguments, e);
    }
  }
}


Hope that helps.

Derrell
------------------------------------------------------------------------------

_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to