The following predefined JavaScript functions apply to tables only:
Adds a row to the table.
Object attributes correspond to the _id of the table columns. The values of the attributes correspond to the value of the cell in the row.
The third argument contains the row data as a JavaScript object, for example, {'userid':'spadmin','age':'31'}.
The following call adds a row with cells named spadmin and 31:
ca_fdAddTableRow('myForm','myTable',{'userid':'spadmin','age':'31'})
The newly added row is automatically selected. The table contains two columns whose _id values are userid and age.
Removes the specified row from the table.
Note: This function removes only rows that users added while editing the form during a request. This function does not remove rows that an administrator populated while creating a dynamic table or static table.
The values of the object attributes correspond to the values of the _id attributes of the cell in the row.
The third argument contains the row data as a JavaScript object, for example, {'userid':'spadmin','age':'31'}. This argument is comma-separated list of key, value pairs, where:
Note: Keys and values do not need to be string constants, but can be JavaScript expressions that evaluate to strings.
For example, the following call removes a row with cells named spadmin and 31:
ca_fdRemoveTableRow('myForm','myTable',{'userid':'spadmin','age':'31'})
Removes all rows from the table, except the rows that were dynamically or statically populated, as explained in the note for the previous item, ca_fdRemoveTableRow(formId, tableId, {}).
The following call removes all user-added rows from the specified table:
ca_fdRemoveAllTableRows('myForm','myTable')
Reruns the report data object associated with the table and refreshes the data in the table.
This function is useful to refresh data based on a change in user input, for example, if both of the following are true:
Note: This function is valid only when you use a report object attribute to populate the table.
Returns the number of rows in the table.
Returns the number of selected rows in the table.
Returns all selected table rows as JavaScript objects.
Examples
The following are sample JavaScript functions for tables, for illustration. In these examples, the following apply:
ca_fdSetTableRow(this.formId, ‘t’, 0, {‘label’ : ‘new row label’, ‘sf’ : ‘3’})
ca_fdFetchTableData(this.formId, ‘t’)
ca_fdGetTableRowCount(this.formId, ‘t’)
alert(JSON.stringify(ca_fdGetSelectedTableRows(this.formId, ‘t’)))
ca_fdUnselectTableRowsByIndex(this.formId, ‘t’, [0 ])
ca_fdUnselectTableRows(this.formId, ‘t’, [{ label text", sf)
ca_fdSelectTableRowsByIndex(this.formId, ‘t’, [0,1])
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |