0

Index value within template from vlayout children?

asked 2019-04-06 22:18:47 +0800

davout gravatar image davout
1435 3 18

I have panel where I displaying a list of entries using a 'vlayout' tag and its 'children' attribute, as shown below...

            <panel title="Product announcements" width="100%" border="normal" >
           <panelchildren>
              <vlayout children="@load(vm.announcements) @template('newsbox')">
                 <template name="newsbox" var="news">
                    <hlayout>
                       <image src="/image/news1.png" width="64px" height="64px" />
                       <vlayout>
                          <label value="@load(news.headline)" />
                          <hlayout>
                             <label  value="@load(news.description)"/>
                             <a label="Read more..." />
                          </hlayout>
                       </vlayout>
                    </hlayout>
                 </template>

              </vlayout>

           </panelchildren>

        </panel>

Is there a way to test the iteration number of the template instance? I want to display a different image for odd and even rows.

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-04-07 01:33:32 +0800

davout gravatar image davout
1435 3 18

Found the answer...

<template name="newsbox" var="news" status="s">

... and then...

s.index is available

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2019-04-06 22:18:47 +0800

Seen: 3 times

Last updated: Apr 07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More