Using Server-Side ActionScript in ColdFusion MX
|
|
Using the CF.query Function
|
The CF.query record set
The CF.query
function returns a RecordSet object, which is an instance of the RecordSet class of objects. The RecordSet class provides a wide range of functions for handling record set data.
You use methods in the RecordSet ActionScript class in your client-side ActionScript to scrub, manipulate, mine, filter, sort, or otherwise change data returned in the CF.query
record set.
Currently, the following methods are available in the RecordSet class:
Method |
Description |
addItem |
Appends a record to the end of the specified RecordSet |
addItemAt |
Inserts a record at the specified index |
addView |
Requests notification of changes in a RecordSet object's state |
filter |
Creates a new RecordSet object that contains selected records from the original RecordSet object |
getColumnNames |
Returns the names of all the columns of the RecordSet |
getItemAt |
Retrieves a record from a RecordSet object |
getItemID |
Gets the unique ID corrresponding to a record |
getLength |
Returns the total number of records in a RecordSet object |
getNumberAvailable |
Returns the number of records that have been downloaded from the server |
isFullyPopulated |
Determines whether a RecordSet object can be edited or manipulated |
isLocal |
Determines whether a RecordSet object is local or server-associated |
removeAll |
Removes all records from the RecordSet object |
removeItemAt |
Removes a specified record |
replaceItemAt |
Replaces the entire contents of a record |
setDeliveryMode |
Changes the delivery mode of a server-associated record set |
setField |
Replaces one field of a record with a new value |
sort |
Sorts all records by a specified compare function |
sortItemsBy |
Sorts all the records by a selected field |
These functions are available for every RecordSet object returned by the CF.query
function to the Flash MX client. You invoke these functions as follows:
objectName.functionName();
For example, in the result function that you create to handle record set data returned by the CF.query
function, you can reference the database column names returned in the record set using the getColumnNames
RecordSet function:
function selectData_result ( result )
{
//result holds the query data; employeesView is a Flash list box
stringOutput.text = result.getColumnNames();
_root.employeesView.setDataProvider(result);
}
Comments