Two Spry tips

This post is more than 2 years old.

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();


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 Andrew Powell posted on 12/16/2006 at 9:40 AM

Good catch on the prototype shortcut.