Cool Spry Tip

This post is more than 2 years old.

I missed this from two versions ago or so, but Spry has a new attribute to make master/detail work a bit easier. In the past, you would typically use code like this to display a set of data and allow a user to click to load a detail region:

<tr spry:repeat="mydata" onclick="mydata.setCurrentRow('{ds_RowID}');">

Notice the onclick? This tells Spry to update the current selected row. This is now done like so:

<tr spry:repeat="mydata" spry:setrow="mydata">

Love it. One more line of JavaScript removed.

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

Archived Comments

Comment 1 by Matt Osbun posted on 10/19/2007 at 4:26 PM

Quick comment on this.

If you are using a select box to update a spry:region, this might not work in IE, depending on how you implement the select box.

If you put your spry:repeat on the option tags within the select, and a spry:setrow on the option tag, the region will not update in IE. Apparently (this is conjecture- if someone knows for sure, please chime in) FireFox allows the select box's onChange event to pass down to the option tag, while IE will not. A co-worker ran into this yesterday.

We think that if he uses spry:repeatchildren and spry:setrow on the select box, then the region will get updated as expected.

Anyway, check your browser compatibility on this one.

Comment 2 by sal posted on 10/20/2007 at 8:48 PM

Gotta a spry question I failed to remember to ask, at the last breezo you did, I'm assuming since these Spry "attributes" are embeded within XHTML tags, that an application leveraging Spry doesn't validate with the W3C as valid XHTML...?


Comment 3 by Raymond Camden posted on 10/20/2007 at 8:55 PM