5.4 Accessing User-Modified Data in a Table

When you configure a Viewsheet table to be “editable” (see Table Properties: Advanced Tab), this allows users to insert, delete, or modify data in the table. Changes that the user makes to the table, however, do not persist after the Viewsheet is closed.

To allow user modifications to persist beyond the current session, you must commit the modified records to the database. (The following section, Committing User-Modified Data to Database (Database Write-Back), provides a full example.) The getFormRows table function provides you with records that have been modified.

Table1.getFormRows(ADDED): Provides a two-dimensional array containing the new rows that have been inserted by the user. The length of the array is equal to the number of inserted rows, and the width of the array is equal to the number of columns in the table.

Table1.getFormRows(CHANGED): Provides a two-dimensional array containing the rows that have been modified by the user. The length of the array is equal to the number of modified rows, and the width of the array is equal to the number of columns in the table.

Table1.getFormRows(DELETED): Provides a two-dimensional array containing the rows that have been deleted by the user. The length of the array is equal to the number of deleted rows, and the width of the array is equal to the number of columns in the table.

Table1.getFormRow(idx): Provides the row designated by index idx.

These functions are typically called within the onClick handler of a Submit Button, as shown in the following section.

When a user adds or changes a row in an editable table, the new or modified row is highlighted in color. To clear the highlight on these rows and remove them from the corresponding array returned by getFormRows, use the table's commit(type) function.

Table1.commit(ADDED): Clears highlights on added rows, and removes them from array returned by getFormRows(ADDED).

Table1.commit(CHANGED): Clears highlight on changed rows, and removes them from array returned by getFormRows(CHANGED).

Table1.commit(DELETED): Removes deleted rows from array returned by getFormRows(DELETED).

Table1.commit(idx): Removes the row returned by getFormRows(idx) from the array of modified rows.

See Also

Accessing Table Data, for information on how to access data in a regular table.

Accessing the Most Recent User Modification, to retrieve a value that the user has just entered.

getFormRow(row), for function reference information.

getFormRows([type]), for function reference information.

Table Properties: Advanced Tab, in Dashboard Design, for information on setting a table as editable.

Validating User Input, in Dashboard Design, for information on restricting the values that a user can enter.

Committing User-Modified Data to Database (Database Write-Back), for information on updating the database with modified information.

<< 5.3 Accessing Data With Absolute/Mixed References © 1996-2013 InetSoft Technology Corporation (v11.5) 5.5 Accessing User-Modified Data from TextInput >>