Hi,

you are doing crazy stuff with the binding. I am impressed that it worked
that well so far. ;)
But i can explain you why its not working like it should.

The problem begins with your bindItem:
controller.bindProperty('hiddenmenu','source',options_menu,
item.getUserData('in_menu'), id);
As you can see, you are not using the item itself as target. The binding
tries to read the model from the target item (usually the treeFolder) and
passes that to the converter. Your target has no idea what its model is so
its just not working.

The only solution I see is to bind the tree folder again and use the
targetPropertyPath to bind it. But this only works if the children are
accessible as properties. So you should subclass the tree folder, add the
items in the subclass and make them available via properties.

This would solve your problem and would structure your code a bit.

Best,
Martin



benco wrote:
> 
> Hi Martin,
> 
> I couldn't make it work in the Playground... Maybe my code is too long
> because it always throws this error - 052715 playground.Application[f]:
> TypeError: this.getTarget().getRoot() is null...
> 
> Anyway, I've attached a demo file 
> http://n2.nabble.com/file/n4105146/Application.js Application.js  to this
> post. 
> 
> The /** ISSUE HERE **/ comment shows where the problem seems to be.
> 
> Best, 
> 
> Benoît.   
> 
> 
> 
> 
> 
> 
> MartinWittemann wrote:
>> 
>> Hi Benoît,
>> I have a quite good idea. We fix that bug not passing the models into the
>> converter and you can use the way described in the documentation. ;)
>> But to do that, I need a code snippet to reproduce the behavior. The unit
>> tests i just created seem to work so maybe you are doing something
>> different. Can you extend a playground example to show that but?
>> Regards,
>> Martin
>> 
>> 
>> 
>> benco wrote:
>>> 
>>> Hello again,
>>> 
>>> I'd like to bind some model properties to a specific widget. As I work
>>> with a Tree controller, I could use the bindProperty function() to
>>> achieve doing it. 
>>> 
>>> But this function only allows to bind "a" property's value of a model,
>>> not "several" properties' values... In my case, I must perform some
>>> tests (boolean conditions on several properties) in order to know what
>>> my options.converter must return.  
>>> 
>>> I'd like to see this kind of code working but of course, I know it
>>> won't: controller.bind(null,'targetprop', options, targetwidget, model);
>>> // the null would pass the entire model to the options.converter
>>> function.
>>> 
>>> After reading  the documentation about the
>>> qx.data.SingleValueBinding.bind() function, I thought I could still
>>> accomplish this because it mentions that the options.converter()
>>> function allows two parameters : the model property val and the entire
>>> model variable. But it seems not to be correct as my second parameter is
>>> always null.
>>> 
>>> Any idea or workaround to my problem (without surrounding model
>>> properties by another 'container' property) ?
>>> 
>>> Regards,
>>> 
>>> Benoît.
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Further-questions-about-bindings-and-option-maps-converter-tp4100391p4106408.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to