DataSet.clear()

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

dataSetInstance.clear()

Returns

Nothing.

Description

Method; removes the items in the current view of the collection. Which items are considered "viewable" depends on any current filter and range settings on the current iterator. Therefore, calling this method might not clear all of the items in the collection. To clear all of the items in the collection regardless of the current iterator's view, use DataSet.removeAll().

If DataSet.logChanges is set to true when you invoke this method, "remove" entries are added to DataSet.deltaPacket for all items in the collection.

Example

The following example removes all items from the current view of the DataSet collection. Because the logChanges property is set to true, the removal of those items is logged.

my_ds.addItem({name:"Milton", years:3});
my_ds.addItem({name:"Mark", years:3});
my_ds.addItem({name:"Sarah", years:1});
my_ds.addItem({name:"Michael", years:2});
my_ds.addItem({name:"Frank", years:2});

my_ds.addSort("nameSort", ["name"]);
my_ds.filtered = true;
my_ds.filterFunc = function(item:Object):Boolean {
    return (item.years >= 3);
};
my_ds.logChanges = true;
my_ds.clear(); // Remove filtered items from dataset.
my_ds.removeSort("nameSort");

See also

DataSet.deltaPacket, DataSet.logChanges


Flash CS3