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.
{firstname} {lastname}, {firstname} {lastname}
ds_RowID | Last Name | First Name |
---|---|---|
{ds_RowID} | {lastname} | {firstname} |
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>