[Laszlo-dev] Replication example

P T Withington ptw at pobox.com
Thu Nov 27 06:04:46 PST 2008


[Adding laszlo-dev]

I think you should start with the simplest possible example, which is  
explicit replication, without even having a dataset.  Then add a local  
dataset, and if possible, a remote dataset.  We would really like  
implicit replication to go away, so I would not even give an example  
of that.  Please cc Lou on any discussions, so he is aware of what L- 
in-10 has and can make sure the main documentation doesn't conflict.

Here is a (pretty simple) explicit replication example without a  
dataset:

    <attribute name="sauces" value="['chocolate', 'lavender', 'olive',  
'orange', 'plum', 'snow', 'thistle', 'violet']" />
    <combobox name="sauce" editable="false">
      <replicator nodes="$once{canvas.sauces}">
        <textlistitem text="${this.presentValue()}" type="color" />
      </replicator>
    </combobox>

But, maybe you can come up with something even simpler, no need to  
actually drag in combobox...

On 2008-11-26, at 23:30EST, J Crowley wrote:

> So, I'm trying to come up with a replication example that's simple  
> enough to fit in with the other L-in-10 stuff yet demonstrates the  
> two primary ways of doing data replication (explicit and implicit).   
> Do you think I should also get into lazy replication and stuff like  
> that as well?  Or does this look good?
>
> Here's what I have so far... I just wanted to get some idea as to  
> how simple/complex I should make this:
>
> <canvas>
> <dataset name="dset">
>  <phonebook>
>    <employee>
>      <firstName>John</firstName>
>      <lastName>Smith</lastName>
>      <phone>617-536-7855</phone>
>    </employee>
>    <employee>
>      <firstName>Lisa</firstName>
>      <lastName>Jones</lastName>
>      <phone>617-536-5216</phone>
>    </employee>
>    <employee>
>      <firstName>Erika</firstName>
>      <lastName>Nelson</lastName>
>      <phone>617-536-8188</phone>
>    </employee>
>  </phonebook>
> </dataset>
> <view width="200" height="70" bgcolor="0x666699">
>  <simplelayout axis="y"/>
>  <text fgcolor="white" fontstyle="bold" text="Implicit Replication"/>
>    <view datapath="dset:/phonebook/employee"
>        layout="axis: x" fgcolor="white">
>    <text datapath="firstName/text()"/>
>    <text datapath="lastName/text()"/>
>    <text datapath="phone/text()"/>
>  </view>
> </view>
> <view width="200" height="70" y="80" bgcolor="0x666699">
>  <simplelayout axis="y"/>
>  <text fgcolor="white" fontstyle="bold" text="Explicit Replication"/>
>    <replicator dataset="dset" xpath="phonebook/employee">
>      <view layout="axis: x" fgcolor="white">
>        <text datapath="firstName/text()"/>
>        <text datapath="lastName/text()"/>
>        <text datapath="phone/text()"/>
>      </view>
>  </replicator>
> </view>
> </canvas>
>
> Thanks!
>



More information about the Laszlo-dev mailing list