Re: Issue 28 in json-template: Provide @index variable for the current array index

30 views
Skip to first unread message

json-t...@googlecode.com

unread,
Jul 5, 2015, 7:32:39 AM7/5/15
to json-t...@googlegroups.com

Comment #11 on issue 28 by maik.der...@googlemail.com: Provide @index
variable for the current array index
https://code.google.com/p/json-template/issues/detail?id=28

How can i use @index to indicate odd and even columns in a table?

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

json-t...@googlecode.com

unread,
Jul 5, 2015, 2:55:10 PM7/5/15
to json-t...@googlegroups.com

Comment #12 on issue 28 by andyc...@gmail.com: Provide @index variable for
Using @index with table ROWS is more conventional.

COLUMNS probably require <colgroup> and <col> tags. If the number of
columns is static (doesn't depend on template data), then you shouldn't
need JSON Template variables at all.

Most tables I've created have static columns.

Here is an example of @index,

http://chubot.org/json-template/test-cases/testIndex-01.html

You can add a formatter like this:

{@index|even-odd}

even-odd could be registered as a function that returns "blue" or "red"
depending on the value of @index.

There should be some examples of how to register formatters in the unit
tests.
Reply all
Reply to author
Forward
0 new messages