Getting the columns of a Spry Dataset

This post is more than 2 years old.

A friend asked yesterday how he could get the columns from a dataset in Spry. I was sure there was an API for this, but it turns out there isn't. Luckily for me (and maybe not for Adobe), I've got the Spry guys on speed dial so I can bug them directly. Here is what Kin Blas had to say:

You can get the columns for a given row in JS like this:
var row = ds.getCurrentRow(); var colNames = []; for (colName in row) colNames.push(colName);
Now keep in mind that because folks aren't always consistent in their XML output (they make attributes optional, sometimes the same elements don't have the same number of elements underneath them, etc ... that a given row may have more or less columns than the one that precedes it.

Thanks Kin! I did mention to him that it would be a good idea to add a formal API for this.

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