[Laszlo-dev] Fwd: [JIRA] Created: (LPP-4632) Dataset doesn't send oninit event

Henry Minsky henry.minsky at gmail.com
Mon Sep 3 06:41:07 PDT 2007


On 9/3/07, P T Withington <ptw at openlaszlo.org> wrote:
> It would make sense to me that a static dataset would send an
> 'ondata' event at startup.  It seems like a reasonable thing to expect.
>
> But.  I bet that is going to raise the issue of what should happen if
> someone sends an event and no one is listening.  It is easy for me to
> imagine that a static dataset might send this event before the
> relevant listeners have been initialized sufficiently to be listening.
>
I think that's what is happening, the startup for initialiazing the
dataset calls this routine
function setData( data , headers ) {
    if ( data == null ) return;
    if (data instanceof Array) {
        this.setChildNodes( data );
    } else {
        this.setChildNodes( [data] );
    }

    this.data = data;

    if ('responseheaders' in this && this.responseheaders != null) {
        this.responseheaders.destroy();
    }
    this.responseheaders = headers;

    if (this.ondata.ready) this.ondata.sendEvent( this );
}

And I suspect that the last line, "if (this.ondata.ready) " is
returning false because
some listener isn't set yet (what makes an event "ready"?)





> We might have to implement a 'wakeup-waiting' state in events.  And
> that is sure to break some things.
>
> We seem to have some events that really depend on event counts being
> accurate, and other events that just need to know whether or not an
> event happened.  I don't think our event API necessarily guarantees
> accurate counts...
>
> On 2007-09-02, at 21:54 EDT, Henry Minsky wrote:
>
> > [I wanted to bring this to the whole team for discussion/consensus]
> >
> >
> > You bring up an issue that I've wondered about for a while; should a
> > dataset always send an ondata event in every case?
> >
> >  Currently, 'static' datasets (i.e. datasets with
> > compile-time-specified literal data) do not
> > send ondata events when they are initialized. I preserved this
> > behavior  in LPS 4 from previous versions of LPS, but I was never sure
> > if that was the right semantics.
> >
> > In the example you give, your dataset is 'static', i.e., it is not an
> > HTTP request or other dynamic loading of data.  So it seems to me that
> > "doRequest()" method should not
> > really do anything at all.  In this case, you could send the data
> > event manually, but that
> > seems like a kludge as well:
> >
> >
> >   <dataset name="mydset" request="true">
> >         <!-- oninit handler doesn't fire either -->
> >         <handler name="oninit">
> >             this.ondata.sendEvent(this.data);
> >         </handler>
> >     </dataset>
> >
> > So maybe we should make all  'static' datasets send an ondata event
> > when they are initialized? Or make an explicit method which forces a
> > "ondata" event? I just am not sure
> > that overloading doRequest() is the right thing to do....
> >
> >
> >
> >
> >
> >
> > ---------- Forwarded message ----------
> > From: Pablo Kang (JIRA) <jira at laszlosystems.com>
> > Date: Sep 2, 2007 5:45 PM
> > Subject: [JIRA] Created: (LPP-4632) Dataset doesn't send oninit event
> > To: hminsky at laszlosystems.com
> >
> >
> > Dataset doesn't send oninit event
> > ---------------------------------
> >
> >                  Key: LPP-4632
> >                  URL: http://www.openlaszlo.org/jira/browse/LPP-4632
> >              Project: OpenLaszlo
> >           Issue Type: Bug
> >           Components: LFC - Data
> >     Affects Versions: 4.0.3
> >             Reporter: Pablo Kang
> >          Assigned To: Henry Minsky
> >
> >
> > This in turn doesn't fire doRequest if request="true".
> >
> > <canvas debug="true">
> >
> >     <handler name="oninit">
> >         Debug.write('canvas init');
> >     </handler>
> >
> >     <!-- request set to true but doRequest doesn't fire -->
> >
> >
> > </canvas>
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the
> > administrators:
> > http://www.openlaszlo.org/jira/secure/Administrators.jspa
> > -
> > For more information on JIRA, see: http://www.atlassian.com/
> > software/jira
> >
> >
> >
> >
> > --
> > Henry Minsky
> > Software Architect
> > hminsky at laszlosystems.com
>
>


-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com


More information about the Laszlo-dev mailing list