View Full Version : datapath question
ch_bowen
09-19-2003, 10:22 AM
I have a class that use's a datapath and its xpath points to a dataset. This view is displayed ondata and displays fine. There can be many windows that appear on the screen at once. The problem is, after each subsequent request, if there is a previous window(s) on the screen, there data also changes because they are all pointing to the same dataset. What is the best way to get around this behaviour?
Thanks alot.
antun
09-19-2003, 10:56 AM
The behaviour you're experiencing is by design - that's how data binding works. When a window is bound to data in a dataset, and that data changes, the contents of the window are updated.
If that's not what you want, then use a different dataset for each window. You could "pass" a dataset to an instance of a class, so that they don't clash:
<canvas>
<dataset name="foo">
<myroot attr="smelly" />
</dataset>
<dataset name="bar">
<myroot attr="very smelly" />
</dataset>
<class name="myclass">
<attribute name="ds" type="string" />
<text name="mytextfield" width="100">
<method event="oninit">
this.setAttribute( 'datapath', parent.ds + ':/myroot/@attr' );
</method>
</text>
</class>
<simplelayout axis="y" spacing="10" />
<myclass ds="foo" />
<myclass ds="bar" />
</canvas>
-Antun
ch_bowen
09-19-2003, 11:24 AM
I realize that is what data binding is suppose to do, I was just wondering if there was some attribute or method that could be used to prevent it from happening in some cases. I think that what you shown me in your example will work.
Thanks again.
UV2003
10-27-2004, 04:44 PM
I would also like to figure out a way to do something like this.
I am creating a portfolio viewer application and I want to load data just-in-time and will not be changing it once it is loaded.
Currently, it loads a series of class instances:
[ ] [ ]
[ ] [ ]
[ ] [ ]
When the user clicks on one, it expands to fill the screen and the datapath attribute is set in that instance and the xpath bindgins fill in the the elements as needed, but when I minimize the instance and click another, the previous instance also changes incorrectly (though I know by design).
I can dynamically create a dataset for each class instance, but in this case I do not need the data to hang around.
If I can find a way to "turn off" the binding after its initial usage, that would be ideal, or to only apply the binding when a method is called, rather than have it be explicitly bound. I could do it all programmatically too, but I don't want to lose the flexibility of the datapath attribute to repeat tags as needed, etc...
-Josh
Originally posted by ch_bowen
I realize that is what data binding is suppose to do, I was just wondering if there was some attribute or method that could be used to prevent it from happening in some cases. I think that what you shown me in your example will work.
Thanks again.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.