User Guide

DataSet.filterFunc 363
The following example populates a DataGrid component from content dynamically loaded
using the XMLConnector component. When a user clicks a CheckBox instance on the Stage,
the contents of the DataSet component are filtered and are updated automatically in the
DataGrid component.
Drag the following components to the Stage, and give them the following instance names:
CheckBox (editorsChoice_ch)
DataGrid (reviews_dg)
DataSet (reviews_ds)
XMLConnector (reviews_xmlconn)
Download a copy of the following XML document, and save it to your local hard disk:
www.helpexamples.com/flash/xml/reviews.xml. This XML document loads dynamically
using the XMLConnector component,. You’ll use the local copy to import the XML schema
into the DataSet component. Select the XMLConnector instance on the Stage, and select the
Schema tab from the Component inspector. Select the
results property, and click Import a
Schema From a Sample XML File. Select the XML document that you downloaded to your
local hard disk, and click Open. The schema of the XML document should import into the
DataSet component. With the
reviews_xmlconn XMLConnector instance still selected on
the Stage, add a binding from the
reviews_xmlconn.results.reviews.review array to the
dataProvider property of the reviews_ds DataSet instance. Set the direction of the data
binding to Out in the Bindings tab. Select the
reviews_ds DataSet instance on the Stage,
and add another binding for the
dataProvider property. With the reviews_ds instance
selected, select the Bindings tab of the Component inspector. Click the Add Binding button
and add a binding from the
dataProvider property of the DataSet component to the
dataProvider property of the reviews_dg DataGrid instance.