PDA

View Full Version : onData and dataElement methods


tspratt
01-23-2004, 01:10 PM
Getting data from an HTTP source is obviously asynchronous, and we must monitor an onData event to work with the new data. The data replaces the whole dataset, and the onData is easy to work with.

But what about the data element methods, like addNodeFromPointer, deleteNode, and in v2, insert, replace and append child?

Do we need to monitor an onData event to work with data changed with these methods?

If so, how would we set up the xpath for a datapointer to receive an onData event from, say, replaceChild?

antun
01-23-2004, 01:39 PM
If you have a datapointer set up with an ondata event, it should fire regardless of how the data was updated.

Does that answer your question?

-Antun

tspratt
01-26-2004, 11:18 AM
I apparently can reference a node updated with a data element method immediately, and do not need to use an on data event.

I can:
newChild = lzDataElement.appendChild(addChild),
then immediately do:
newChild.setAttr("name","newName").

I do NOT need an ondata on a datapointer pointing at lzDataElement. This is good, because continually manipulating the pointer was causing me difficulty.

This also appears to be true of datapointer methods like addNodeFromPointer.

antun
01-26-2004, 11:49 AM
That sounds right. Only requests over HTTP are asynchronous.

-Antun