[Laszlo-user] propriety of using data field in a view
Elliot Winard
enw at laszlosystems.com
Wed Sep 5 13:31:52 PDT 2007
I'm talking about the 'data' field in a view, not in the data-related
classes.
Because 'ondata' is a defined event on any node, I kinda expect that
'data' will be too.
I agree that the 'data' field in datasets and lzdataelements shouldn't
be used by LZX developers.
-e
Henry Minsky wrote:
> I think using childNodes is essentially equivalent, and it's well
> defined, so that would be a better thing to do. The 'data' field is
> used internally, but it wasn't ever really defined
> for public use. It should probably have a name like __data or
> something to keep people
> from using it.
>
>
> We do use "data" as a field on LzDataText to get the text content, but
> that is not a W3C DOM API standard
> I think.
>
>
>
> On 9/5/07, Elliot Winard <enw at laszlosystems.com> wrote:
>
>> If I have a bunch of instances of data-bound views (or class instances)
>> that access the object's .data property. This is not a documented field
>> in LzView or LzNode but I started using it when I caught [ondata]
>> events. See example below.
>>
>> My question is.... is it safe to refer to the data property of a
>> data-bound view? If so, I'll log a LPP bug that it should be documented.
>>
>> Thanks!
>> -e
>>
>> <canvas height="500" debug="true">
>> <dataset name="ds">
>> <item name="Harry" />
>> <item name="Ron" />
>> <item name="Hermione" />
>> </dataset>
>>
>> <button text="set data one"
>> onclick="myview.setDatapath('ds:/item[1]')" />
>> <button text="set data many" onclick="myview.setDatapath('ds:/item')" />
>>
>> <view name="myview">
>> <datapath />
>> <handler name="ondata" args="d">
>> // code does stuff based on this.data here
>> Debug.write("ondata", d, this.data);
>> </handler>
>> <text datapath="@name" />
>> </view>
>>
>> <simplelayout />
>> </canvas>
>>
>>
>>
>
>
>
More information about the Laszlo-user
mailing list