Changes between Initial Version and Version 1 of Ticket #12162


Ignore:
Timestamp:
Nov 4, 2009, 2:07:05 PM (15 years ago)
Author:
Alex Gaynor
Comment:

Please use preview.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12162 – Description

    initial v1  
    11Hear me out. :)  My use case is this: I have a large table, I have already ordered the objects that will make up each row according to a certain key attribute. What I would like to do is use the 'cycle' tag together with the 'ifchanged' tag to change the bg-color of the rows only when this key attribute has changed. E.g.:
    2 
     2{{{
    33(blue) New Mexico John ...
    44(blue) New Mexico Jill ...
     
    88(blue) Arizona James ...
    99...
    10 
     10}}}
    1111But, it just can't be done (in the template) as things stand. Every access of the 'cycle' tag (whether named or not) gives the next value in the cycle. I propose an alternate tag that picks up the cycle variable without changing it from its last appearance. Then code like this ought to be able to accomplish the task:
    12 
     12{{{
    1313{% ifchanged state %}
    1414  <tr style="background:{% cycle 'blue' 'green' as rowbg %};">
     
    1616  <tr style="background:{% dontcycle rowbg %};">
    1717{% endifchanged %}
    18 
     18}}}
    1919I really believe this is a legitimate presentation task. Thanks for your consideration.     K.C.S.
Back to Top