Spry update on the way

This post is more than 2 years old.

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...

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com