RecordSet.replaceItemAt( )

RecordSet.replaceItemAt( ) Method Flash 6

replaces a row in a recordset
   myRecordSet   .replaceItemAt(   index   ,   record   ) 



An integer that is between and the length of the RecordSet object minus one.


An object with properties that match the fields of the existing RecordSet object.


The replaceItemAt( ) method replaces the contents of an entire row in a RecordSet object. This allows for functionality similar to the SQL update statement. Typically, you use this method to update the contents of row of data in your RecordSet object that will be reflected in a display in the Flash movie, such as in a DataGrid.


The following code shows the replaceItemAt( ) method in use, replacing the contents of one row and tracing the RecordSet object's length to the Output window:

 #include "" var myRecordset_rs = new RecordSet(["First","Last","Email"]); myRecordset_rs.addItem({First:"",Last:"",Email:""}); var firstname = firstname_txt.text; var lastname = lastname_txt.text; var email = email_txt.text; myRecordset_rs.replaceItemAt(0,{First:firstname,Last:lastname,Email:email}); trace(myRecordSet.getLength( )); 

This code creates a recordset and adds one row. Then the first row (in the position) is replaced . The Output window reports that the recordset still contains only one row.

See Also

RecordSet.addItemAt( ) , RecordSet.removeItemAt( ) , RecordSet.setField( )

Flash Remoting
Flash Remoting: The Definitive Guide
ISBN: 059600401X
EAN: 2147483647
Year: 2003
Pages: 239
Authors: Tom Muck © 2008-2017.
If you may any questions please contact us: