I know, i only wanted to see a practical advanced usage of tapestry. Everywhere is a lot of basic examples, but i haven't found clear example of nested loop in loop.

My issue is with handler onAddRowFromTimeRangeLoop(OpeningItem openingItem). Parameter "openingItem" is always null, encoder of outer loop is not called, but I dont know why. Probably i've overlooked something.

.tml

<t:ajaxformloop t:id="openingItemLoop" t:source="unsavedOpeningItems" t:value="openingItem" t:encoder="openingItemEncoder">

    <t:ajaxformloop t:id="timeRangeLoop" source="openingItem.timeRangeList"
        t:value="timeRange" encoder="timerangeEncoder" t:context="openingItem">

        <div class="time-range-item">
                <t:cb.businesshours.timeperiod period="timeRange"/>
        </div>

    </t:ajaxformloop>

</t:ajaxformloop>


.java

    @Persist
    @Property
    private List<OpeningItem> unsavedOpeningItems;

    @Property
    private OpeningItem openingItem;
    @Property
    private TimeRange timeRange;

    @Inject
    private TypeCoercer typeCoercer;

    private ValueEncoder<OpeningItem> openingItemEncoder;

    public ValueEncoder<OpeningItem> getOpeningItemEncoder()
    {
        if (openingItemEncoder == null)
this.openingItemEncoder = new OpeningItemEncoder(unsavedOpeningItems);

        return openingItemEncoder;
    }

    public ValueEncoder<TimeRange> getTimeRangeEncoder()
    {
        return new TimeRangeListEncoder(openingItem.getListableId(),
                                        openingItem.getTimeRangeList());
    }

    @SetupRender
    public void initialize()
    {
        if (unsavedOpeningItems == null)
            unsavedOpeningItems = openingHours.getOpeningItemsList();
    }

    public OpeningItem onAddRowFromOpeningItemLoop()
    {
OpeningItem periodicOpening = entityFactoryService.createOpeningItem();

        unsavedOpeningItems.add(periodicOpening);

        return periodicOpening;
    }

    public TimeRange onAddRowFromTimeRangeLoop(OpeningItem openingItem)
    {
        List<TimeRange> timeRangeList = openingItem.getTimeRangeList();
        TimeRange timeRange = entityFactoryService.createTimeRange();
        timeRangeList.add(timeRange);

        return timeRange;
    }



Thanks,
Jan

On Fri, 20 Sep 2013 11:11:16 +0200, Boris Horvat <horvat.z.bo...@gmail.com> wrote:

Best thing to do is post your code and what error you get that will help
anyone who would be able to help

Cheers


On Fri, Sep 20, 2013 at 10:20 AM, Jan Fryblik <jan.fryb...@ebrothers.cz>wrote:

**

Hi guys,

could you please provide me a example how to work with AjaxFormLoop inside
AjaxFormLoop? Or more generaly loop inside loop. I'm stuck with it. I
guess, it's a bit advanced use of tapestry. Thanks in advance.


Best Regards,
Jan









--
S pozdravem



Mgr. Jan Fryblík
jednatel
+420 739 094 784
jan.fryb...@ebrothers.cz

eBrothers Software s.r.o. | www.ebrothers.cz

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to