For example, you might create an XML data set, ds1, with the following code:
<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"> var ds1 = new Spry.Data.XMLDataSet("myXML.xml","xpath"); </script>
For more information, see the individual sections on creating data sets.
<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" src="includes/SpryPagedView.js"></script>
The SpryPagedView.js file is in the same includes folder as all of the other Spry JavaScript files. For more information, see the Preparing your files sections in the individual sections on data sets.
<script language="JavaScript" type="text/javascript"> var ds1 = new Spry.Data.XMLDataSet("myXML.xml","xpath"); var pv1 = new Spry.Data.PagedView( ds1 ,{pageSize: 20}); </script>
The value of the constructor’s first parameter is the name of the primary data set, in this case, ds1. The second parameter in the constructor is optional, and in this example specifies how many rows to display per page. In the example, the Paged View data set displays 20 rows of data per page.
The completed example code might look as follows:
<head> ... <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" src="includes/SpryPagedView.js"></script> <script language="JavaScript" type="text/javascript"> var ds1 = new Spry.Data.XMLDataSet("myXML.xml","xpath"); var pv1 = new Spry.Data.PagedView(ds1 ,{pageSize: 20}); </script> ... </head>
<div spry:region="pv1" spry:repeatchildren="pv1"> {data} </div>
The Paged View data set uses the same data reference names ({data} in the example above) as the primary data set.