Two Spry tips

I've got 30 minutes before my next pain pill so I'm having a bit of clarity. I thought I'd share two Spry tips that Kin and Donald (the Spry Guys) shared with me. Neither of these relate to the new 1.4 release, they are just things I missed before. I have to say, for Spry being "incomplete", it certainly has a lot in there!

Tip #1: If you want to grab a document node by id, you would typically do this in JavaScript:

var myField = document.getElementById('something');

However, Spry has supported the Prototype shortcut for a while now:

var myField = $('something');

Pretty handy shortcut.

Tip #2: When working with datasets, you may notice that Spry is smart enough to not make an HTTP request if you don't actually have any Spry regions on the page that make use of the dataset. Smart. But what if you want Spry to make the request anyway? Use the loadData() function on dataset:

var mydata = new Spry.Data.XMLDataSet("foo.xml","//item"); mydata.loadData();


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.