Whatever message this page gives is out now! Go check it out!
| Function syntax | Description |
|---|---|
object.addColumn(name) | Adds a column to all rows in a WddxRecordset instance. |
object.addRows(n) | Adds rows to all columns in a WddxRecordset instance. |
object.dump(escapeStrings) | Displays WddxRecordset object data. |
object.getField(row,col) | Returns the element in a row/column position. |
object.getRowCount() | Indicates the number of rows in a WddxRecordset instance. |
object.setField(row, col, value) | Sets the element in a row/column position. |
object.wddxSerialize(serializer) | Serializes a record set. |
<!--- 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>| Parameter | Description |
|---|---|
object | Instance name of the WddxRecordset object |
name | Name of the column to add |
// 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);| Parameter | Description |
|---|---|
object | Instance name of the WddxRecordset object |
n | Integer; number of rows to add |
// 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);object.getField( row, col ) |
| Parameter | Description |
|---|---|
object | Instance name of the WddxRecordset object |
row | Integer; zero-based row number of the value to return |
col | Integer or string; column of the value to be returned. |
for (row = 0; row < nRows; ++row)
{
o += "<tr>";
for (i = 0; i < colNames.length; ++i)
{
o += "<td>" + r.getField(row, colNames[i]) + "</td>";
}
o += "</tr>";
}object.getRowCount( ) |
| Parameter | Description |
|---|---|
object | Instance name of a WddxRecordset object |
function dumpWddxRecordset(r)
{
// Get row count
nRows = r.getRowCount();
...
for (row = 0; row < nRows; ++row)
...object.setField( row, col, value ) |
| Parameter | Description |
|---|---|
object | Instance name of a WddxRecordset object |
row | Integer; row that contains the element to set |
col | Integer or string; the column containing the element to set |
value | Value to set |
// 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);object.wddxSerialize( serializer ) |
| Parameter | Description |
|---|---|
object | Instance name of the WddxRecordset object |
serializer | WddxSerializer instance |
...
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);
}
...