I’m new to Javascript and need help. I have a Spry dataset
that has just one row called “type”. From within the script I want
to test the value of “type” – depending on its value I want to sort
a second dataset with multiple rows using different columns. For
instance if the “type” is “adults” the second data set will be
sorted on the “lastName” column and if “type” is equal to
“children” the data will be sorted on the “firstName” column.
if ( ‘{ds1::type}’ == ‘adults’) { ds2.sort(‘lastName’)}
else { ds2.sort(‘firstname’) }
… how do I access the dataset data from within a script? I
read that the Spry datasets are Javascript array of objects but I
just can figure out how to get at the data – I’ve tried notation
like: ds1[0].type and ds1.type[0] – I need a lesson in accessing
Spry dataset object data!
|||
Hi schep,
You can find the Data Set api here:
http://labs.adobe.com/technologies/spry/articles/data_api/index.html
Basically you want something like this:
var rows = ds1.getData(); // Get all rows.
if (rows[ 0 ].type == “adults”) // Check the type of the
first row’s “type” column.
ds2.sort(“lastName”);
else
ds2.sort(“firstname”);
–== Kin ==–
Related posts:
- PagedView/DataSet sorting problem
- Spry deal with many xml files
- Grabing Data from an XMLDataSet without using spry:region
- Spry dataset: change URL and reload
- Spry dataset: change URL and reload
Related posts brought to you by Yet Another Related Posts Plugin.