Data Set Sample

This page is an example of how to manually set up a non-XML data set that can be used with a spry:region or spry:detail region.


 

Kirk Davis, James Miller, Alex Wilson, Albert Moore, Eric Taylor, Vincent Anderson, Anthony Thomas, John Lee, Edward Smith, Neil Johnson, Steve Williams, John Jones, Joe Brown

ds_RowIDLast NameFirst Name
0DavisKirk
1MillerJames
2WilsonAlex
3MooreAlbert
4TaylorEric
5AndersonVincent
6ThomasAnthony
7LeeJohn
8SmithEdward
9JohnsonNeil
10WilliamsSteve
11JonesJohn
12BrownJoe

 


The code used to set up the data set used in the live sample above looks like this:

<script language="JavaScript" type="text/javascript" src="../../includes/xpath.js"></script>
<script language="JavaScript" type="text/javascript" src="../../includes/SpryData.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
//
// Step 1: Create an array of objects that contain your data. Each object in the
//         array will serve as our rows in the data set. Each object should have
//         the same set of properties on them.
//

var myArrayOfData = [
	{ lastname: "Davis", firstname: "Kirk" },
	{ lastname: "Miller", firstname: "James" },
	{ lastname: "Wilson", firstname: "Alex" },
	{ lastname: "Moore", firstname: "Albert" },
	{ lastname: "Taylor", firstname: "Eric" },
	{ lastname: "Anderson", firstname: "Vincent" },
	{ lastname: "Thomas", firstname: "Anthony" },
	{ lastname: "Lee", firstname: "John" },
	{ lastname: "Smith", firstname: "Edward" },
	{ lastname: "Johnson", firstname: "Neil" },
	{ lastname: "Williams", firstname: "Steve" },
	{ lastname: "Jones", firstname: "John" },
	{ lastname: "Brown", firstname: "Joe" }
];

//
// Step 2: Create a DataSet object.
//

var dsPeople = new Spry.Data.DataSet();

//
// Step 3: Call the data set's setDataFromArray() function and
//         give it the data array.
//

dsPeople.setDataFromArray(myArrayOfData);
-->
</script>