Quantcast

The Oddness (and Evenness) of Spry 1.4

Get the WebProNews Newsletter:


[ Business]

Ok, I’m not sure if “evenness” is really a word, but if Steve Colbert can make stuff up – so can I. Before Spry 1.4, Spry supported a simple way to apply different CSS styles to datasets rows to support even/odd colors.

It was done using the built in variable ds_EvenOddRow. On execution, this would be replaced with even or odd. So in this example:

<tr spry:repeat="dsEmployees" class="{ds_EvenOddRow}">

<tr spry:repeat="dsEmployees" class="{ds_EvenOddRow}">

You would end up with this when the dataset was generated:

<tr class="even"7>
...
<tr class="odd">

<tr class="even"> ... <tr class="odd">

If you wanted different names, you could prepend or append a value to the class like so:

<tr spry:repeat="dsEmployees" class="myds_{ds_EvenOddRow}">

<tr spry:repeat="dsEmployees" class="myds_{ds_EvenOddRow}">

While this worked, it wasn’t the cleanest method. Spry 1.4 introduces a new spry:even and spry:odd tag. This allows you to specify the class to use in each particular case. Consider this example:

<tr spry:repeat="dsEmployees" spry:even="even" spry:odd="odd">

<tr spry:repeat="dsEmployees" spry:even="even" spry:odd="odd">

This ends up being the exact same as the first example, but is a bit more clear.

One more quick example. If you are repeating over multiple datasets, you can tell spry:even and spry:odd what dataset to check for “oddness”. Adobe provides an example of that.

So to see live examples of all of these, visit:

http://labs.adobe.com/technologies/spry/samples/data_region/EvenOddRowSample.html

Comments

Reddit | Furl

Bookmark WebProNews:

Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long
time ColdFusion user, Raymond has worked on numerous ColdFusion books
and is the creator of many of the most popular ColdFusion community web
sites. He is an Adobe Community Expert, user group manager, and the
proud father of three little bundles of joy.

The Oddness (and Evenness) of Spry 1.4
Comments Off
About Raymond Camden
Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy. WebProNews Writer
Top Rated White Papers and Resources

Comments are closed.

  • Join for Access to Our Exclusive Web Tools
  • Sidebar Top
  • Sidebar Middle
  • Sign Up For The Free Newsletter
  • Sidebar Bottom