BUG in Model definition : Alex ?
Alex,
Having spent a week working out the code, I think there may be a bug in the definiton of a model (from a control) and the subsequent setting of a a model property to be an array of values.
I posted more information here: http://www.activewidgets.com/javascript.forum.12190.1/stange-model-behaviour-help-please.html
but, basically if I have initialised my model property to be a primitive type say "" or 0 , then if I susequently assign a array to the property {"0","1","2","3"} then when I call getXProperty I always get the original primitive value returned.
Looking at the code for setting a proptery I can see that it is trying to handle the setting of various types of objects to a property (_X, _X1, _X2, _X3 in the control object) definitions based on the provide value tyope (an object (function), an array, a primitive etc).
When the dynamic getter is called for the property it seems to be checking each declaration type ( _X1, _X2, _X3) to see if is set and then return the value assigned.
But because the primitive value (_X) is not deleted during declaration the getXProperty code never gets the desired value (_X1 the array value) to return.
Phew !!
I hope that is all clear. My apologies for bothering you with this Alex (or anyone else!!) but I think this bug (if thats what it is) is failry serious and debilitating in terms of writing your own widgets, where you need to set your own model.
If anyone wants my code to check it for themselves, please do shout !!
Having spent a week working out the code, I think there may be a bug in the definiton of a model (from a control) and the subsequent setting of a a model property to be an array of values.
I posted more information here: http://www.activewidgets.com/javascript.forum.12190.1/stange-model-behaviour-help-please.html
but, basically if I have initialised my model property to be a primitive type say "" or 0 , then if I susequently assign a array to the property {"0","1","2","3"} then when I call getXProperty I always get the original primitive value returned.
Looking at the code for setting a proptery I can see that it is trying to handle the setting of various types of objects to a property (_X, _X1, _X2, _X3 in the control object) definitions based on the provide value tyope (an object (function), an array, a primitive etc).
When the dynamic getter is called for the property it seems to be checking each declaration type ( _X1, _X2, _X3) to see if is set and then return the value assigned.
But because the primitive value (_X) is not deleted during declaration the getXProperty code never gets the desired value (_X1 the array value) to return.
Phew !!
I hope that is all clear. My apologies for bothering you with this Alex (or anyone else!!) but I think this bug (if thats what it is) is failry serious and debilitating in terms of writing your own widgets, where you need to set your own model.
If anyone wants my code to check it for themselves, please do shout !!
Yasdnil
February 24,