Is this recommended practice? Should it be documented?
In general there is no mention of the ECMAscript prototype in the
Developer's Guide (which is admittedly light on scripting in general).
Should I mention Henry's suggestion in the dguide, or does this belong
in the category of "hacks of which we do not speak"?
jrs
On Jan 4, 2006, at 3:43 PM, Henry Minsky wrote:
Even if the LZX compiler doesn't support it via the XML syntax, I
think you
can extend a class via the underlying script class declaration
mechanism.
Something like
var MyDataset = Class( "MyDataset" , LzDataset );
Then you can define methods on the class with
MyDataset.prototype.somemethod = function (...) { }
Then you can instantiate this with new MyDataset();
You have to manually add event handlers though.
On 1/4/06, Bryan Barkley <[EMAIL PROTECTED]> wrote:
Since extending datasets doesn't seem to be supported can anyone
offer any
suggestions for handling common operations across datasets such as the
situation David describes?
Subclassing dataset could also be useful to provide default error
handling
behavior as well as changing the root src attribute as described in
this
forum thread:
http://www.laszlosystems.com/developers/community/forums/
showthread.php?s=&threadid=2219
All of these cases are aspects that would be somewhere between
difficult
and inconvenient to maintain if they can't be factored into a common
code
location.
I have tried nesting datasets in a datasource that had onerror and
ondata
handlers; that didn't seem to work. The only other thing I can think
of is
finding all datasets at startup and programmatically registering event
handlers with them. This seems pretty hackey.
Anyone have a good solution?
Thanks,
Bryan
On 1/3/06, Buckler, David <[EMAIL PROTECTED]> wrote:
Thats a very interesting idea and I could see how that could cross
the
streams. The reason why I am trying to extend the dataset is to
overload
the doRequest() to include user name/password query parameters for
authentication on every request. So unfortunately a local dataset
wont fix
my problem but thanks for the help.
David
------------------------------
*From:* Henry Minsky [mailto:[EMAIL PROTECTED]
*Sent:* Tuesday, January 03, 2006 2:04 PM
*To:* Buckler, David
*Cc:* [email protected]
*Subject:* Re: [Laszlo-user] Extending Dataset Class in 3.1.1
This might be some fallout from the change which added "local
datasets"
to the compiler.
You can now say put datasets inside of instances or classes like
below.
I wonder if
local datasets might be able to be used in your application instead
of
extending dataset?
<view name="somedata" layout="axis: y" bgcolor="#cccccc">
<method event="onclick">
Debug.write(this.lds);
</method>
<dataset name="lds">
<foo>bar</foo>
</dataset>
<text>local dataset</text>
<method reference="lds" event="oninit">
<![CDATA[
Debug.write("somedata test data loaded", this);
if (this.lds.serialize() != '<lds><foo>bar</foo></lds>') {
Debug.error("somedata serialized data does not match expected
value");
}
]]>
</method>
</view>
On 1/3/06, Buckler, David <[EMAIL PROTECTED]> wrote:
In 3.0.2 I was be able to extend the dataset class, albeit with a
load
of compilation warnings, but it would still work. Now I am moving
to
3.1.1 and this "feature" no longer works. Any ideas?
<canvas>
<class name="myds" extends="dataset"/>
<myds name="z">
<node>Hello Moto</node>
</myds>
<text datapath="z:/node/text()"/>
</canvas>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
_______________________________________________
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
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
_______________________________________________
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