HTML Data Set

Description

The HTML data set allows users to use any HTML table, or HTML structure, as a data source. In the constructor, specify the URL to the file that contains the table or structure, and specify the ID of the table or structure and Spry will pull in the data. This can now be used normally as a data set, with the same region and data reference rules as in other data sets.

The HTML data set is flexible because you can use IDs and class names to filter data and pull in any HTML structure as data.

Please read the HTML data set overview for a full description of the data set.

File

SpryHTMLDataSet.js

Requires

SpryData.js

Inheritance

Notifier -->DataSet --> HTTPSourceDataSet --> HTMLDataSet

getDataSelector

Description

getDataSelector is used to return the currently defined dataSelector of the HTML data set.

The DataSelector is used when defining a generic HTML structure as a data source. The DataSelector tell the data set what element is being used as the 'data' node. This is equivalent to the <TD>, or column, in the table data set.

Format

datasetname.getDataSelector();

Example

var ds1 = new Spry.Data.HTMLDataSet("myfile.htm","myID",{dataSelector:"li"});
x = ds1.getDataSelector();

x= "li"

getRowSelector

Description

getRowSelector is used to return the current value of the RowSelector of the HTML data set.

The RowSelector is used when defining a generic HTML structure as a data source. The RowSelector is used to define the repeating node of the structure. This is equivalent to the <TR> of a table data set.

Format

 datasetname.getRowSelector();

Example

var ds1 = new Spry.Data.HTMLDataSet("myfile.htm","myID",{rowSelector:".rowColor"});

x = ds1.getRowSelector();

x= ".rowColor"

getSourceElementID

Description

getSourceElementID returns the ID of the page element currently defined as the data source. In a HTML data set, you tell Spry the page that contains the data source and the ID of the actual data element. This function returns that ID.

Format

 datasourcename.getSourceElementID();

Example

var ds1 = new Spry.Data.HTMLDataSet("myfile.htm","myID");

x = ds1.getSourceElementID();

Therefore...
x= "myID"

getURL

Description

getURL returns the current path to the data set source file. This is the same function used in the XML data set.

Format

datasetname.getURL();

Example

var ds1 = new Spry.Data.HTMLDataSet("myURL.htm","myID");

x = ds1.getURL();

Therefore...

x = "myURL.htm"

setDataSelector

Description

setDataSelector is used to define or change the currently defined dataSelector for the HTML data set. This is used when defining a generic structure as a data set. The dataSelector tell Spry the element that contains the individual piece of data. This is equivalent to the <TD> tag of a table data set.

The data set will not update automatically after setting the dataSelector. Use the loadData(); to load the new data set.

Format

datasetname.setDataSelector("tag name or CSS ID or class");

Example

var ds1 = new Spry.Data.HTMLDataSet("myfile.htm","myID",{dataSelector:"div"});

ds1.setDataSelector("span");

ds1.loadData();

setRowSelector

Description

setRowSelector is used to define or change the rowSelector used in a HTML data set. The rowSelector defines the repeating node of the HTML structure. This is equivalent to the <TR> tag in an table data set.

The data set will not update automatically after setting the RowSelector. Use the loadData(); to load the new data set.

Format

datasetname.setRowSelector("tag name or CSS ID or class");

Example

var ds1 = new Spry.Data.HTMLDataSet("myfile.htm","myID",{rowSelector:"div"});

ds1.setRowSelector("span");

ds1.loadData();

setSourceElementID

Description

setSourceElementID is used to set or change the ID of the element that contains the data for the data set.

Setting the sourceID will not automatically cause the data set to reload. Use loadData(); to force the new data to load.

Format

datasetname.setSourceElementID("the new ID");

Example

var ds1 = new Spry.Data.HTMLDataSet("myfile.htm","myID");

ds1.setSourceElementID("theNewID");

ds1.loadData();

setURL

Description

setURL is used to set or change the path to the file that contains the data source. setURL works the same way for the HTML data set as it does for the XML data set.

Format

datasetname.setURL("the new URL");

Example

var ds1 = new Spry.Data.HTMLDataSet("myfile.htm","myID");

onClick="ds1.setURL("/assets/myNewFile.htm");
ds1.loadData();"

Copyright © 2007. Adobe Systems Incorporated.
All rights reserved.