GridLayout inside Repeater


#1

Hi,
I’m wondering how to render gridlayout itms inside repeater ?
The code below will not work, as Stacklayouts will be rendered without respecting cols and rows.
Is there any way to do this ?

Thanks you.

<GridLayout rows="*" **columns="*,*,*,*,*,*,*" class="calendar"**>
                    <Repeater items="{{ calendar }}">
                        <Repeater.itemTemplate>
                            <StackLayout **row="0" col="0"** class="cal-item" tap="{{ switchDay }}">
                                <Label text="{{ day }}" class="day"></Label>
                                <Label text="11" class="num"></Label>
                            </StackLayout>
                        </Repeater.itemTemplate>
                    </Repeater>
                </GridLayout>

#2

ok, got it.
the key is to set itemsLayout.

<Repeater items="{{ calendar }}"  rows="*" columns="*,*,*,*,*,*,*">
                        <Repeater.itemsLayout>
                            <GridLayout rows="*" columns="*,*,*,*,*,*,*" class="calendar" />
                        </Repeater.itemsLayout>
                        <Repeater.itemTemplate>
                            <StackLayout row="0" col="{{ id }}" class="cal-item" tap="{{ switchDay }}">
                                <Label text="{{ day }}" class="day"></Label>
                                <Label text="11" class="num"></Label>
                            </StackLayout>
                        </Repeater.itemTemplate>
</Repeater>