Hi Philip.
I suggest you to work the sameway than I sayd for the first mail about using
Xml to generate views.
Try data replication.
- Define a dataset (say stamps) <dataset name="stamps"/>
- When data comes in, filter it if needed and add dit to the dataset
- Define your view that will be replicated (your stamppot class) with an
attribute datapath="stamps:/response/stampList/stamp", and bind the
attributes witl defined attributes like stampid="$path{'id/text()'}".
Doing this ensures you will have your children created anytime you create a
node in the source dataset, and deletes anytime you remove one from the
dataset.
By the way, try using xpath instead of good old DOM Xml navigation, it is
much faster, the reasons given to me (and I fully trust those who said it)
are:
- XPath is built into the flash runtime using pure C++ code
- DOM is based on OL code, so it is interpreted
This way XPath is much faster than DOM access.
Hope this helps.
++
Julien
-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de Philip A. Chapman
Envoyé : jeudi 3 janvier 2008 20:37
À : [email protected]
Objet : [Laszlo-user] Deleting Views
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have a place in my code where I am dynamically creating and adding
subviews to a view in response to data retrieved from a dataset. The
code looks like this (where stamppot is a custom class that extends View):
<method name="loadSuccess"><![CDATA[
// Test to response code to see if the server indicated success (100)
var node =
stampsRequest.getElementsByTagName("response")[0].getElementsByTagName("code
")[0].childNodes[0];
if (node.data == "100") {
var nodes =
stampsRequest.getElementsByTagName("response")[0].getElementsByTagName("stam
pList")[0].childNodes;
for (n in nodes) {
var bg = new stamppot(this.stampdisplay);
bg.stampid =
nodes[n].getElementsByTagName("id")[0].childNodes[0].data;
bg.stamppath =
nodes[n].getElementsByTagName("dataPath")[0].childNodes[0].data;
bg.stampicon.setAttribute('src',
nodes[n].getElementsByTagName("iconPath")[0].childNodes[0].data);
}
Debug.write('Stamps Loaded successful');
} else {
Debug.write('Stamps load failed');
Debug.write('Response data: ' + stampsRequest.serialize());
}
]]></method>
I need to be able to clear out the stampdisplay view or at least delete
stamppot subviews from stampdisplay. Any help would be appreciated.
Thanks,
- --
Philip A. Chapman
Desktop and Web Application Development:
Java, .NET, PostgreSQL, MySQL, MSSQL
Linux, Windows 2000, Windows XP
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHfTlqAdpynRSGw3URAkU5AKCIpI9Fhp+jzZaY72PD5xc4NlEX+wCfe58x
/sO1AFwe4QPQVb1Hq9uczUM=
=towH
-----END PGP SIGNATURE-----