I'm have some code which is trying to update data found in a dataset, but
I'm not having much success. The data displays in a list. I have XML
which looks something like this:
<item>
<count>4</count>
</item>
<item>
<count>10</count>
</item>
...
The count value gets displayed in a textlistitem. Based on some user
action, I want to change the value of count to something else. My code
invokes a method to do this and basically does the following (this is
inside a method in my textlistitem):
var count = this.datapath.xpathQuery("count/text()");
if (count && count != "0") {
var countValue = parseInt(count);
countValue = countValue - 1;
var newNode = new LzDataText(countValue);
var itemCountNode = this.datapath.xpathQuery("count");
if (itemCountNode.hasChildNodes()) {
var subNode = itemCountNode.getFirstChild();
itemCountNode.replaceChild(subNode, newNode);
var itemCount = this.datapath.xpathQuery("count/text()");
this.setAttribute("text", itemCount);
}
}
I've put debug statements in this and I can see that the original node has
the old value (say '4') and my new node has the value '3'. However, the
textlistitem never changes to reflect this, and the next time this method
gets called, the node value is back to '4' again. I'm clearly not doing
something right. Can anyone offer some clarity?
Thanks!
--
James Howe
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user