Try the following code it may yield different results.
But really the best place for an ondata event to keyed from is the
dataset or a datapointer.

<tree name="treeRoot" showroot="false" isleaf="false" >
<datapath xpath="ds:/" ondata="Debug.write('ondata')"/>
    <tree isleaf="false" datapath="foo/bar">
       <tree datapath="*"/>
    </tree>
    <tree isleaf="false" datapath="baz/bar">
       <tree datapath="*"/>
    </tree>
</tree>

If that doesnt work then try using a datapointer to trigger the event
firing like
<datapointer xpath="ds:/" ondata="Debug.write('ondata')"/>

z

On 9/25/06, P T Withington <[EMAIL PROTECTED]> wrote:
> I've always been under the impression that events are guaranteed to
> be fired _at_least_ once, hence your event handler has to be
> [idempotent](http://en.wikipedia.org/wiki/Idempotence_%
> 28computer_science%29).  In particular, it may be that when you
> register an event at init time, it is fired immediately (in case the
> event you wanted has already happened).
>
> If my impression is true, I hope it is documented.  If not, I am at a
> loss to explain the behaviour you are seeing.
>
> On 2006-09-25, at 16:07 EDT, James Howe wrote:
>
> > In my application I've set up a tree which looks roughly like this:
> >
> > <tree name="treeRoot" showroot="false" isleaf="false" datapath="ds:/">
> >    <tree isleaf="false" datapath="foo/bar">
> >       <tree datapath="*"/>
> >    </tree>
> >    <tree isleaf="false" datapath="baz/bar">
> >       <tree datapath="*"/>
> >    </tree>
> > </tree>
> >
> > The dataset contains other elements which I don't want to be in the
> > tree
> > which is why I have the two subtrees setup to use a specific datapath
> > instead of simply using "*".  I want the root tree to do something
> > when
> > new data arrives.   My assumption was that whenever I requested data
> > from the dataset (ds) I would receive an ondata event at my root tree.
> > I added a method to "treeRoot" which does this:
> >
> > <method event="ondata>
> >     Data.write("On data");
> > </method>
> >
> > When I start my application, I immediately get the 'On data' message,
> > even though I haven't requested any data from my dataset.  However,
> > when
> > I actually do request data from the dataset, my ondata event
> > doesn't get
> > called.  The tree, however, displays correctly.  I'm sure I'm doing
> > something stupid, but can anyone offer ideas on what I might be doing
> > wrong?
> >
> > Thanks!
> > --
> >   James Howe
> >
> >
> >
> > _______________________________________________
> > Laszlo-user mailing list
> > [email protected]
> > http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to