|
ColdFusion 9.0 Resources |
WddxRecordset objectIncludes functions that you call as needed when constructing a WDDX record set. For more information on using this object, see Using WDDX in the Developing ColdFusion Applications. Functions
UsageConvenient for debugging and testing record sets. The boolean parameter escapeStrings determines whether <>& characters in string values are escaped as <>& in HTML. Example<!--- Create a simple query --->
<cfquery name = "q" datasource ="cfdocexamples">
SELECT Message_Id, Thread_id, Username, Posted
FROM messages
</cfquery>
<!--- Load the wddx.js file, which includes the dump function --->
<script type="text/javascript" src="/CFIDE/scripts/wddx.js"></script>
<script>
// Use WDDX to move from CFML data to JS
<cfwddx action="cfml2js" input="#q#" topLevelVariable="qj">
// Dump the record set
document.write(qj.dump(true));
</script>
addColumnParameters
UsageAdds a column to every row of the WDDX record set. Initially the new column’s values are set to NULL. ExampleThis example calls the addColumn function: // Create a new record set
rs = new WddxRecordset();
// Add a new column
rs.addColumn("NewColumn");
// Extend the record set by 3 rows
rs.addRows(3);
// Set an element in the first row
// newValue is a previously defined variable
rs.setField(0, "NewColumn", newValue);
addRowsParameters
UsageThis function adds the specified number of rows to every column of a WDDX record set. Initially, the row/column values are set to NULL. ExampleThis example calls the addRows function: // Create a new record set
rs = new WddxRecordset();
// Add a new column
rs.addColumn("NewColumn");
// Extend the record set by 3 rows
rs.addRows(3);
// Set an element in the first row
// newValue is a previously defined variable
rs.setField(0, "NewColumn", newValue);
getFieldsetFieldParameters
ExampleThis example calls the setField function: // Create a new recordset
rs = new WddxRecordset();
// Add a new column
rs.addColumn("NewColumn");
// Extend the record set by 3 rows
rs.addRows(3);
// Set an element in the first row
// newValue is a previously defined variable
rs.setField(0, "NewColumn", newValue);
wddxSerializeParameters
ExampleThis example is from the WddxSerializer serializeValue function: ...
else if (typeof(obj) == "object")
{
if (obj == null)
{
// Null values become empty strings
this.write("<string></string>");
}
else if (typeof(obj.wddxSerialize) == "function")
{
// Object knows how to serialize itself
bSuccess = obj.wddxSerialize(this);
}
...
|