Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.removeSort() | |||
Flash Player 7.
Flash MX Professional 2004.
dataSetInstance.removeSort(sortName)
sortName A string that specifies the name of the sort to remove.
Nothing.
Method; removes the specified sort from this DataSet object if the sort exists. If the specified sort does not exist, this method throws a DataSetError exception.
The following example creates a range of items in the DataSet component and modifies the gradeLevel property of each item. To test this example, drag a DataSet component to the Stage, and give it an instance name of my_ds. With the DataSet component selected, create three new properties in the schema of the DataSet component by using the Schema tab in the Component inspector. Name the new properties name, id, and gradeLevel, and give them the data types of String, Number, and Number respectively. Add a copy of the DataBindingClasses compiled clip from the Classes common library (Window > Common Libraries > Classes) and add the following ActionScript to Frame 1 of the main timeline:
my_ds.addItem({name:"Billy", id:104, gradeLevel:4});
my_ds.addItem({name:"Bobby", id:105, gradeLevel:4});
my_ds.addItem({name:"Carrie", id:106, gradeLevel:4});
my_ds.addItem({name:"Cathy", id:110, gradeLevel:4});
my_ds.addItem({name:"Mally", id:112, gradeLevel:3});
my_ds.addSort("name_id", ["name", "id"]);
my_ds.setRange(["Bobby", 105], ["Cathy", 110]);
while (my_ds.hasNext()) {
my_ds.gradeLevel = "5"; // Change all of the grades in this range.
my_ds.next();
}
my_ds.removeRange();
my_ds.removeSort("name_id");
for (var i=0; i<my_ds.length; i++) {
trace(my_ds.items[i].name + " > " + my_ds.items[i].gradeLevel);
}
DataSet.applyUpdates(), DataSet.hasNext(), DataSet.next(), DataSet.removeRange(), DataSet.setRange()
Flash CS3