Name
DataGlue.bindFormatFunction( ) Method
Synopsis
DataGlue.bindFormatFunction(dataConsumer
,dataProvider
,formatFunction
)
Arguments
-
dataConsumer
The UI component or other consumer of data to be bound to a data provider.
-
dataProvider
A RecordSet object or other data provider to be bound to a data consumer.
-
formatFunction
A custom function that you define that returns an object with the properties
label
anddata
. It must accept a single RecordSet object as a parameter.
Description
The DataGlue object is used to bind a data provider to a data consumer. The most common and useful application of this is to bind a RecordSet object to a ListBox, ComboBox, or other UI component that will display the data from the RecordSet. The bindFormatFunction( ) method allows the developer to specify a function to format the appearance of the data in the UI component. If you don’t need to format the data, using DataGlue.bindFormatStrings( ) is more straightforward.
Example
The following example code assumes a combo box named
allProducts_cb
is present on the main timeline:
#include "NetServices.as"
#include "DataGlue.as"
// Initialize the connection and service objects.
if (connected == null) {
connected = true;
NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway");
var my_conn = NetServices.createGatewayConnection( );
var myService = my_conn.getService("com.oreilly.frdg.searchProducts", this);
}
// The remote getSearchResult( )
method (not shown) returns a recordset. myService.getSearchResult( ...
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.