On Tue, Oct 12, 2010 at 16:10, nrg-b <[email protected]> wrote:
>
> 1. When I tried to call a member function, myfunc(), in the rpc handler I
> got a "myfunc() is not defined" error message. If I called the member
> function by qualifying as "this.myfunc()" then I get "this.myfunc is not a
> function". I noted that when adding a listener, there is an option to pass
> in 'this' in order to set the function's context. Please can you tell me
> what is the value 'this' in an Rpc handler function? The only way I could
> get round the issue about was to make the function a static one.
>
There are a couple of ways to handle this.
1. Use a closure.
var handlerContext = this;
handler = function()
{
...
handlerContext.doSomething()
...
}
If you're not familiar with closures, they're worth reading up on. In this
case, when the function object is created, the function has access to (and
*retains* access to) the handlerContext. As long as you don't change the
value of handlerContext, this will allow you to access that context when
your handler function is called.
2. Bind an object to the handler function
handler = qx.lang.Function.bind(function()
{
...
this.doSomething()
...
},
this);
The static method qx.lang.Function.bind() binds a context to a function, so
that when that function is called, it acts as if it were a method of the
object to which it is bound. The 'this' variable inside your provided
function is whatever you passed as the second parameter to
qx.lang.Function.bind().
2. The json data returned is an array of nested maps (ie array of
> composites). In SelectBox a property chain (ie dot-notation path) can be
> used to bind the displayed labels to a value deep within a nested object
> structure. I wanted to do the same thing for tables. Please may I ask if
> this is part of your roadmap then when do you think its likely this feature
> will be released? I am using qx version 1.2. In the meantime, I've written
> some bespoke code to create the rowdata (2d array) for a Simple tablemodel
> from the json data and an array of property-paths.
>
Someone else will be better able to answer that question.
>
> 3. I have some hidden table columns. AFAIK, table column visibility is set
> via the column model eg: mytable.getTableColumnModel().setColumnVisible(0,
> false); // make 1st col invisible
>
> But this only happens after the table model is set which could briefly show
> all cols before the desired ones are made invisible. Is it possible to set
> the column visibility when configuring the table model ie before the table
> model is set into a table?
>
One of the entries in the 'custom' map provided to the table constructor is
'initiallyHiddenColumns' which is an array containing the column numbers
that should be initially invisible. This was a somewhat recently-added
feature (it may not even be in the released version) so if you're not
already using trunk, you should either switch to it, or await the
(impending, I believe) next release.
Cheers,
Derrell
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel