Actually I just looked again and the setPointer method *is* mentioned in the hierarchy of LzDatapath in the LZ Reference documentation. I just overlooked it (several times).
On Wed, 12 Apr 2006 15:18:45 -0400, James Howe <[EMAIL PROTECTED]> wrote: > Thanks. That did the trick. The one thing I had been missing was the > 'setPointer' method on LzDatapath. I was looking at the reference > documentation for LzDatapath and I did not see any reference to a > 'setPointer' method. It's not listed as one of the methods inherited > from LzDatapointer. The reference documentation for LzDatapointer does > contain a description for setPointer. What had been confusing me was > that I > wasn't seeing a method which would let me change things based on a data > node. The setPointer method was what I had missed. > > Thanks again and I think I'll file a documentation error report on the > setPointer thing. > > On Wed, 12 Apr 2006 12:09:01 -0400, Adam Wolff <[EMAIL PROTECTED]> > wrote: > >> Here's the general approach you want to take. >> >> What you want to do is to hand your editor a LzDataElement that is >> cloned >> from the template. Note that this node doesn't need to be part of a >> dataset; you can hand an xml node directly to a datapath that you've >> declared >> >> <class name="editor" extends="window"> >> <!-- be sure to create a datapath, since we're not going to use >> xpath >> for databinding here --> >> <datapath/> >> >> >> var newnode = template.getFirstChild().getFirstChild().cloneNode( true >> ); >> >> editor.datapath.setPointer( newnode ); >> //user fills out form >> .... >> >> //when user clicks ok >> editor.datapath.updateData(); >> ds1.getFirstChild().appendChild( editor.datapath.p ); >> >> Hope this helps. >> >> A >> >> On Apr 11, James Howe wrote: >> >>> I've been working on a data related problem for the last few days which >>> really has me confused. I must be missing something. I'm trying to do >>> something very simple. I have two XML datasets: >>> >>> <dataset name="ds1"> >>> <items> >>> <item name="foo" address="bar"/> >>> </items> >>> </dataset> >>> >>> <dataset name="template"> >>> <items> >>> <item name="" address=""/> >>> </item> >>> </dataset> >>> >>> I have a simple editor which is bound to ds1 with a datapath like this: >>> >>> datapath="ds1:/items/item" >>> >>> The user can change things in the editor and save them. They can also >>> select 'New' to start again. What I've been trying to figure out is >>> how >>> to clone the item element from my template dataset and use it to >>> replace >>> the edited value found in ds1. Looking in the documentation I can see >>> how >>> I could add the template item to ds1 and then delete the original node >>> from ds1 using the addNodeFromPointer, but then if the user edits the >>> values, the values in my template are disturbed. What I want to do is >>> add >>> a deep clone of my template node to the ds1 dataset so that if/when it >>> gets edited, my template remains unaffected. >>> >>> What am I missing? I can find the node I'm interested in by doing >>> xpathQueries. I can clone the LzDataElement returned from the >>> xpathQuery. Once I have that, I don't see how I can add that element >>> as a >>> node in my ds1 dataset. >>> >>> Any help on this would be greatly appreciated. >>> >>> Thanks! >>> >>> > > > -- James Howe _______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
