Hello Christian,

now its much clearer what you try to achieve. Thanks for the details  
on it. :)
I'll try to write a test for exactly your secenario and check if i can  
reproduce the "reser" error you described. Looks like a bug in the  
single value binding now. I'll get back to you as soon as I have some  
results.

Best,
Martin

Am 19.06.2009 um 21:48 schrieb panyasan:

>
>
> Martin Wittemann wrote:
>>
>> Hi Christian,
>>
>> I did take a look at your code but could not find the place where you
>> use the bindValue method. So I could not see where the problem is and
>> why the reset is called.
>>
>> I have to admit that I don't get completely why you need to do it the
>> way you do it. What is targetObject and what is the targetPath?
>>
>
> Sorry if I have been unclear. qcl.config.Manager has  has a "model"
> property:
>
>    /*
>     * The config manager's data model which can be
>     * bound to a data store. It must be an qx.core.Object
>     * with two properties, "keys" and "values", which
>     * contain config keys and values, respectively and
>     * will be converted to qx.data.Array objects
>     */
>    model :
>    {
>      check : "qx.core.Object",
>      nullable : true,
>      event : "changeModel",
>      apply : "_applyModel"
>    }
>
> The model property is bound to a JsonRpc datastore's model property,  
> so when
> the datastore has finished loading, it's model property is  
> transferred (in
> fact, it is the same object, as you have designed the mechanism). It  
> would,
> for example, look like this (pseudo-code):
>
> property 'model' : qx.core.Object
> {
>  property 'keys' : qx.data.Array(["foo","bar","baz"]),
>  property 'properties' : qx.data.Arrray([1,2,3])
> }
> which corresponds to the configuration value map { foo:1,bar:2,baz: 
> 3 }.
>
> So if I want to bind the value of a textfield tf to the value of the  
> config
> key "bar", I would do
>
>  qcl.config.Manager.getInstance().bindValue("bar",tf,"value",true);
>
> Here is the bindValue method:
>
>    /**
>     * Binds a config value to a target widget property in both
>     * directions.
>     * @param key {String}
>     * @param targetObject {qx.core.Object}
>     * @param targetPath {String}
>     * @param updateSelfAlso {Boolean} Optional, default undefined
>     * @return
>     */
>    bindValue : function( key, targetObject, targetPath,  
> updateSelfAlso )
>    {
>      var index = this._getIndex( key );
>      /*
>       * update the target widget property when config value changes
>       */
>      targetObject.bind( targetPath, this, "model.values[" + index +  
> "]" );
>
>      /*
>       * update config value if target widget property changes
>       */
>      if ( updateSelfAlso )
>      {
>        this.bind( "model.values[" + index + "]", targetObject,  
> targetPath
> );
>      }
>    }
>
> So each time the config value changes (when loaded from the server  
> or is set
> manually), the value of tf changes. On the other hand, if the user  
> changes
> the value of tf, the config value is updated. Since the values are  
> kept in a
> qx.data.Array, internally, I have to bind tf.<value> to
> qcl.config.Manager.getInstance().getModel().<values>[1].
>
> So in my example, targetObjet is the textfield tf and targetPath is  
> "value".
>
> Does that make the case clear?
>
> Thanks,
>
> Christian
>
>
>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Databinding%3A-TypeError%3A-target-%22reset%22-%2B-qx.lang.String.firstUp%28lastProperty%29--is-not-a-function-tp24099676p24117746.html
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge  
> conference!
> Portland, OR, June 17-19. Two days of sessions, one day of  
> unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>


------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to