RecordSet.addView

Availability

Usage

RecordSet.addView(object)

Parameters

Parameter
Description
object
An ActionScript object to be notified when the RecordSet object changes.

Return value

Nothing.

Description

Method. Defines an ActionScript object that will receive notifications when the RecordSet object changes. The object must contain a modelChanged function, which takes one parameter, and an event descriptor object. The following table describes the event descriptor messages:
Message
Description
{event:"addRows", firstRow:xxx, lastRow:yyy}
Row numbers xxx through yyy have been added.
{event:"allRows"}
All records have arrived from the server. In other words, theRecordSet object is now fully populated.
{event:"deleteRows", firstRow:xxx, lastRow:yyy}
Row numbers xxx through yyy have been deleted.
{event:"fetchrows", firstRow:xxx, lastRow:yyy}
Row numbers xxx through yyy have been requested from the server, but have not arrived yet.
{event:"sort"}
The record set has been sorted.
{event:"updateAll"}
The RecordSet object has changed in some way, such as a new view being added.
{event:"updateRows", firstRow:xxx, lastRow:yyy}
Row numbers xxx through yyy have changed in some way.

Example

The following example shows the use of the addView method. The modelChanged function displays a trace message with the event type each time the record set changes.

#include "NetServices.as"
  function modelChanged(info)
  {
    trace(info.event);
  }

  var productList = new RecordSet(["Name","Price","Color"]);

  // whenever productlist changes, call this.modelChanged().
  productList.addView(this);

  // modify the RecordSet object, and see if "modelChanged" gets called
  productList.addItem({Name: "milk", Price: 3.50, Color: "0xffffff"});
  productList.addItem({Name: "eggs", Price: 1.75, Color: "0xffffff"});

See also

Constructor for RecordSet

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flashremoting/mx/Using_Flash_Remoting_MX/asDict29.htm