Hello,
Thank you for your reply, and now I get how the field is being used,
knowing that you are listed as one of the developers, I was hoping that
maybe you had time to answer a second question:
In my original post, I stated the reason I was interested in this field
(I need to modify the header cell renderer used, because I wanted to
include a Filter (Text) Field in the header).
The solution I found to this problem, was to create the following class:
qx.Class.define("tc.table.columnmodel.FilteredModel", {
extend: qx.ui.table.columnmodel.Basic,
events: {
"changeColumnFilter": "tc.event.type.ColumnFilter"
},
/* One Way of Solving the Problem with the Default Header Renderer
construct: function () {
this.base(arguments);
// Save the value for the Default Renderer
this.__saveDefaultRenderer =
qx.ui.table.columnmodel.Basic.DEFAULT_HEADER_RENDERER;
},
*/
members: {
// __saveDefaultRenderer: null,
init: function (colCount, table) {
// Simpler Method to Solve the Problem
this.__headerRenderer = new tc.table.headerrenderer.Filtered();
// Add the Listener for the Change Filter
this.__headerRenderer.addListener('changeColumnFilter', function
(e) {
this.dispatchEvent(e.clone());
}, this);
// Modify Default Renderer - Before Calling Base Class
// qx.ui.table.columnmodel.Basic.DEFAULT_HEADER_RENDERER =
tc.table.headerrenderer.Filtered;
// Call Bass Class
this.base(arguments, colCount, table);
// Restore Default Renderer
// qx.ui.table.columnmodel.Basic.DEFAULT_HEADER_RENDERER =
this.__saveDefaultRenderer;
}
}
});
As you can see:
1. One possible solution was to override, the qooxdoo "class static"
member qx.ui.table.columnmodel.Basic.DEFAULT_HEADER_RENDERER
2. The other was to simply ignore that __headerRenderer is a "private
member".
In both cases, even though the solution works, it leaves a bad taste and
I was wondering if there was another more "normal" way to handle this
problem.
TIA
PF
> On Wed, Oct 17, 2012 at 9:45 AM, Paulo Ferreira <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hi,
>
> I've come across a strange situation.
>
> I wanted to create a Table with a Text Field in the Column Header and
> came across the following piece of code in qooxdoo 2.0.2.
>
> In the init member "qx.ui.table.columnmodel.Basic", I found the
> following piece of code:
>
> var headerRenderer = this.__headerRenderer || (this.__headerRenderer =
> new qx.ui.table.columnmodel.Basic.DEFAULT_HEADER_RENDERER());
>
> Easy enough to understand (i.e. if the __headerRenderer is not set, use
> the default Default Renderer. Okay..
>
> What I don't understand, since I was not able to find any code to the
> contrary, is under what conditions would __headerRenderer would be set?
>
>
> The init() function may be called multiple times. What this line of code
> is doing is instantiating a single instance of default header renderer,
> and saving a reference to it. When init() is called again,
> __headerRenderer will already be set (having been set during the first
> call to init()), so the same instance of the default header renderer is
> used, rather than instantiating a new one.
>
> Derrell
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel