View Full Version : delete node problem / resolve by using data replication?
ch_bowen
07-18-2003, 07:12 AM
I notice that there is some strange behaviour with using Datapointer.deleteNode(). I can add nodes fine to a datapointer, but when deleting all the nodes on a 'clear' method where I iterate through some nodes and calling deleteNode(), I am unable to add the nodes again. I have searched the forum and it has been stated that there is strang behavior using dp.deleteNode(). An alternative method suggested was using data replication. Ideally I would like to reset my dataset to an empty set each time I call a clear() method. Is there a simple way of doing this. I know I could go to an external datasource for a solution and request an empty dataset, but there has to be a cleaner way. Any suggestions?
Thanks alot.
antun
07-18-2003, 09:20 AM
There shouldn't be any problems with Datapointer.deleteNode() at all. Were you perhaps referring to this post:
http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=211&highlight=deletenode
The above post is about the Node.deleteNode() method:
http://www.laszlosystems.com/developers/learn/documentation/lzxref/node.php#meth-deleteNode
Here's a quick way of clearing out a dataset:
<canvas debug="true">
<dataset name="myds">
<myroot>
<myfirstchild />
<myfirstchild />
<myfirstchild />
<myfirstchild />
<myfirstchild />
</myroot>
</dataset>
<button>
<method event="onclick">
var dp = myds.getPointer();
dp.setXPath( 'myds:/myroot[1]' );
debug.write( '= before ==============================' );
var s = dp.serialize();
debug.write( s );
dp.deleteNode();
s = dp.serialize();
debug.write( '= after ==============================' );
debug.write( s );
</method>
</button>
</canvas>
Does that help?
-Antun
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.