deform, alternate row colors

15 views
Skip to first unread message

Bobby

unread,
Sep 12, 2011, 4:30:30 PM9/12/11
to pylons-discuss
I could not find anything on alternate row colors in the deform docs.
I know chameleon uses a variable named "repeat" to achieve this
functionality, but this variable does not seem to be available in the
scope of the template. However there is available a variable named
"counter". I could use "counter" to write some modulo division to
figure out if the row is odd or even. Ideally I could just use the
chameleon variable which is already prepared. How would I make the
"repeat" variable available? OR, should I just stick to using
"counter" and some logic?

Dirley

unread,
Sep 13, 2011, 9:48:15 AM9/13/11
to pylons-...@googlegroups.com
All you have to do is override "templates/sequence.pt" and pass the "repeat" variable through rndr. The exact line you'll have to edit is this one:

    <div tal:repeat="tup subfields" tal:replace="structure rndr(item_tmpl, field=tup[1], cstruct=tup[0], parent=field) "/>

Here you can pass any variable (in your case, repeat=repeat.tup) down to "templates/sequence_item.pt", which you can also override and set the alternate backgrounds styles on each "sequence row".

2011/9/12 Bobby <bobby.ch...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.


Reply all
Reply to author
Forward
0 new messages