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_RowID | Last Name | First Name |
---|---|---|
0 | Davis | Kirk |
1 | Miller | James |
2 | Wilson | Alex |
3 | Moore | Albert |
4 | Taylor | Eric |
5 | Anderson | Vincent |
6 | Thomas | Anthony |
7 | Lee | John |
8 | Smith | Edward |
9 | Johnson | Neil |
10 | Williams | Steve |
11 | Jones | John |
12 | Brown | Joe |
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>