[Laszlo-user] initstage="defer" not working as supposed
Daniel Garrido
djbgarrido at gmail.com
Fri May 23 07:45:10 PDT 2008
You're right Robert.
I just added a dummy subnode and the initstage="defer" worked. Could
never have guessed that :S
I really appreciate your help, but I feel very insecure using this
framework, cause I'm mostly depending on your help to move forward.
Anyway thanks a lot for your help. Laszlo should be very grateful to you.
Regards,
Daniel
On Fri, May 23, 2008 at 3:37 PM, Robert Yeager <ryeager0 at gmail.com> wrote:
> The behavior of the initstage is not well documented, and may not even be
> consistent.
>
> According to this Jira I filed some time ago, the initstage only applies to
> children of a node (view): http://www.openlaszlo.org/jira/browse/LPP-4260
>
> Net result, is that since your view doesn't have a child the initstage is
> being ignored. You can work around that by either adding a dummy child view,
> or by adding a wrapping parent view with its initstage set.
>
> Robert Yeager
> http://www.qrowd.com
> http://www.cooqy.com
>
> On Fri, May 23, 2008 at 9:51 AM, Daniel Garrido <djbgarrido at gmail.com>
> wrote:
>>
>> Hi Laszlo community,
>>
>> I'm writing this email in order to get help understanding an issue
>> with initstage. I've read that setting initstage of a view to defer
>> would disable the calling of of the init handler, that would only be
>> called if the completeInstantiation() method is used.
>>
>> So I'm trying to use this in order to make sure the remotecalls
>> invocation in an init handler are only done, after the in loading of
>> the javarpc.
>>
>> Unfortunately the init handler is called anyway and so I'm getting an
>> error with invoking remote calls that aren't yet available:
>>
>> Equipment's init handler called
>> ERROR: getAvailableModels could not invoke; is remote service loaded?
>>
>> Created component equipment
>> __LZloaderReturnData data= «Object#1| {..., stubinfo: [object Object],
>> stub: [object Object]}»
>> ... loadmc= «LoadObj#2| undefined (loading)»
>> ...responseheaders= undefined
>> «Object#1| {..., stubinfo: [object Object], stub: [object Object]}»
>> Configuration loaded
>>
>> Below is the code I'm using:
>>
>> <canvas width="100%" height="100%" bgcolor="0xc92222" debug="true">
>> <!--<include href="resources/resources.lzx" /> -->
>>
>> <handler name="onconstruct">
>> canvas.configuration.load();
>> </handler>
>>
>> <security>
>> <allow>
>> <pattern>^configuration\.Configuration</pattern>
>> </allow>
>> </security>
>>
>> <javarpc name="configuration" scope="session"
>> remoteclassname="configuration.Configuration"
>>
>> createargs="['/home/daniel/workspace/BoundmoreGUI/database/configuration.xml']">
>>
>> <handler name="onload">
>> Debug.write("Configuration loaded");
>> canvas.equipment.completeInstantiation();
>> </handler>
>>
>> <handler name="ondata" args="res">
>> Debug.write('(types ondata) response is:', res);
>> </handler>
>>
>> <handler name="onerror" args="errmsg">
>> Debug.write('(types onerror) error:', errmsg);
>> </handler>
>>
>> <remotecall name="getAvailableModels"
>> funcname="getAvailableModelsOL" />
>> <remotecall name="selectModel" funcname="selectModelOL" />
>> <remotecall name="getInstanceDate"
>> funcname="getComponentsDate" />
>> </javarpc>
>>
>> <node name="equipment" initstage="defer">
>> <handler name="oninit">
>> Debug.write("Equipment's init handler called");
>> var dataset = new LzDataset(this);
>> dataset.setName("available_models");
>>
>> canvas.configuration.getAvailableModels.setAttribute('dataobject',
>> this.available_models);
>>
>> canvas.configuration.getAvailableModels.invoke(['equipment']);
>> Debug.write("Created component " + this.name);
>> </handler>
>> </node>
>> </canvas>
>>
>
>
More information about the Laszlo-user
mailing list