Spry update on the way

A little birdie just let me know that a very cool Spry update is on the way. It includes a feature I've been asking about for a while now - custom display functions. What do I mean? Consider the following example (thanks Donald Booth for the code):

<script type="text/javascript">

function FormattedPrice(region, lookupFunc) { return "$" + parseInt(lookupFunc("{dsProducts::price}")).toFixed(2); } </script>


<div spry:region="dsProducts"> <ul spry:repeatchildren="dsProducts"> <li>{name} - {function::FormattedPrice} </li> </ul> </div>

Spry will now recognize function:: as a custom JavaScript function. In this example, it formats a price to include a dollar sign and 2 decimal places.

You can even use functions in conditions. Consider:


function checkName(rgn, doIt) { return doIt('{name}') == 'Adobe Studio 8'; }


<div spry:if="function::checkName">

This could really simplify complex display code. When will this be released? Soon...

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.