[Laszlo-user] Forcing a replication manager

Michael Brady mbrady at appliedminds.com
Wed Jun 20 04:43:26 PDT 2007


Hi Robin,

Looks like this is about what  you're doing already, but here's what I 
do in that situation:

-----------------------------------------------------------
     // There are two possibilities.  The "entry" object may a single
     // text item, or it may be a replication manager.
     // For a single item, just look at it.
     // For a replicated list, iterate over the list.

     var isSingleItem = entry['getCloneNumber'] == undefined;

     if (isSingleItem) {

       // When the entry hasn't been replicated,
       // its datapath dp can be null.
       var hasDp = entry.datapath.p != null;

       if (hasDp) {
         // Do something with "entry".
       }
     }

     var i = 0;
     var currClone = entry.getCloneNumber(i++);
     while (currClone != null) {
       // Do something with "currClone".
       currClone = entry.getCloneNumber(i++);
     }
-----------------------------------------------------------

Unfortunately, I don't know of any way to force replication programatically.

If you find a better way, please post it to the list.  I'd like to know it.

Cheers,

Michael

Robin Sheat wrote:
> Hi, if I have something like:
> 
> <mycomponent datapath="thepath" />
> 
> and thepath only matches one thing, no replication manager is used. This means 
> that there is extra checking required when interacting with this component, 
> as it may be many components contained inside a replication manager, or it 
> may be just the component itself, and this state may change when more data 
> comes along or gets deleted later.
> 
> I'd like to have something that runs through all the potentially replicated 
> mycomponent instances when the cloning is done and they've been rendered (in 
> this case I want to calculate a value based on them). I can do this fine if 
> there's multiple ones (there's an example for this in the docs), however it 
> seems I have to also have a separate hook in place in case there's only one 
> thing. What I'd like to be able to do is force replication even if there's 
> zero or one items being replicated, that way the one bit of code will handle 
> them all. Is this possible, or is there another recommended way of doing this 
> sort of thing?
> 


More information about the Laszlo-user mailing list