Name

RecordSet.addView( ) Method

Synopsis

                     myRecordSet.addView(object)

Arguments

object

An object with a method named modelChanged( ) that is notified of changes to the recordset.

Description

The addView( ) method allows you to specify an object to be notified whenever changes occur to a RecordSet object. This allows you to perform certain actions in response to those changes. For example, if you want to implement a recordset logging feature, you can use an object that displays information about the recordset in the Output window whenever the recordset changes.

Typically addView( ) is used during debugging to verify that certain events happened. Chapter 4 discusses the method in detail, and Example 4-3 creates a RecordSetDebug.as file containing methods to view recordsets for debugging purposes.

Table 15-3 shows the event information sent to the object specified in the addView( ) method. It also indicates which operations generate each event.

Table 15-3. Events tracked in the addView( ) method

Event

Information object returned

Occurs when

addItem( ) and addItemAt( ) methods

{event:"addRows”, firstRow:n, lastRow:nn}

Row numbers between n and nn are added

onResult( ) method of responder object

{event:"allRows"}

The recordset is fully populated from the server

removeAll( ), removeItemAt( )

{event:"deleteRows”, firstRow:n, lastRow:nn}

Row numbers between n and nn are deleted

onResult( ) method of responder object

{event:"fetchrows”, firstRow:n, lastRow:nn}

Row numbers between ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.