Type | Name | Description | Notes |
Boolean | autoRowLockingEnabled | Contains true if the data source automatically calls refreshAndLockRow on the underlying table as soon as an attempt is made to modify an existing row. This is useful when using IliSQLTable objects in order to implement the "pessimistic concurrency control policy". (See IliSQLTable::concurrencyControl for more information.) Initially, this property is false . | |
Boolean | autoSelectEnabled | When this property is true , the data source automatically calls the select method if a given event occurs. The table of a data source may have parameters defined. Some of these parameters may have been mapped on another data source. It can be said that a data source depends on other data sources through the parameters of its table. Therefore, if the autoSelectEnabled property is true , the data source will call the select method whenever one of the data sources on which it depends undergoes a current row change. Initially, this property is set to false . | |
Int | columnsCount | Contains the number of columns in the table. | read-only |
Int | currentRow | Contains the position (counting from 0) of the current row. It contains -1 if the data source is not positioned on any row and a value equal to the value of the rowsCount property if it is positioned on the insert row. | |
Int | deletedRow | Contains the row position that is to be deleted. | read-only |
Int | fetchedRow | Contains the row position that is fetched. | read-only |
Boolean | inputModified | Contains true when the current row has been modified by the user and these changes have not yet been validated. | read-only |
Boolean | insertEnabled | Contains true if new rows can be inserted in the table through the data source. Initially, this property is set to true . | |
Boolean | readOnly | This property is true if the data source is read-only. | |
Int | rowsCount | Contains the number of rows in the table. | read-only |
IliTable | table | Contains the table object managed by the data source. | read-only |
String | tablePropertyManagerName | Contains the name of the table property manager used by the data source or null if the default table property manager is used. Initially, this property is null . | |
Boolean | useTableProperties | Contains true if the data source uses table properties. Initially, this property is true . | |
Void | addError(String message) | Forwards an application error message to all the error sinks that have been added with the addErrorSink function. | |
Void | addErrorMessage(IliErrorMessage message) | Forwards an application error message to all the error sinks that have been added with the addErrorSink function. | |
Void | addErrorSink(Object sink) | Adds an error sink to the data source. When an error occurs, it will be forwarded to this error sink.
The sink parameter can be either:
| |
Boolean | applyQueryMode() | Applies the query that the user specified while in query mode. The original data source table is restored and its select method is called. This method returns true if successful. Any errors that occur will be reported to the user by calling the reportErrors method. | |
Boolean | applyQueryModeSilently() | This method is similar to the applyQueryMode method except that errors will not be reported to the user. | |
Void | cancel() | Cancels any user input awaiting validation. The contents of the row buffer are discarded, the current row is read back from the table and its values are copied into the data source's row buffer, and the inputModified property is set to false . The CancelEdits callback is called. | |
Void | cancelQueryMode() | Cancels query mode by restoring the original data source table. | |
Void | clear() | Calls table.clearRows . Any pending user input is first canceled by this method. | |
Boolean | deleteCurrentRow() | Deletes the current row of the data source as long as the current row is an actual row. It returns true if successful. Before the row deletion, the PrepareDelete callback is called, which can prevent any further processing of the deletion by calling the dontDeleteRow method. | |
Void | dontDeleteRow() | Called from the PrepareDeleteRow callback. It stops the deletion of the row whose position is given by the deletedRow property. The addError method should be called to provide the user with a descriptive error message. | |
Void | dontValidateRow() | Called from either the ValidateRow , PrepareUpdate , or PrepareInsert callbacks. It stops the row validation from proceeding. The addError method should be called to provide the user with a descriptive error message. | |
IliDataSourceColumn | getColumn(String colname) | Returns the description of the column named colname . Note that the columns become properties of the data source so that the following expressions are equivalent:
dataSource.getColumn("NAME")
dataSource.NAME
| |
IliDataSourceColumn | getColumnAt(Int colno) | Returns the description of the column positioned at colno . | |
Boolean | gotoFirst() | Changes the current row of the data source to the first row of the table after validating any pending user input. It returns true if successful. | |
Boolean | gotoLast() | Changes the current row of the data source to the insert row if insertion is allowed or to the last row if not. Any pending user input is first validated by this method. It returns true if successful. | |
Boolean | gotoNext() | Changes the current row of the data source to the next row, after validating any pending user input. If the current row is the last row of the table and if insertion is allowed, the current row changes to the insert row. It returns true if successful. | |
Boolean | gotoPrevious() | Changes the current row of the data source to the previous row (as long as the current row is not the first row). Any pending user input is first validated by this method. It returns true if successful. | |
Boolean | gotoRow(Int rowno) | Changes the current row of the data source to the row designated by rowno . If rowno equals -1 , the data source will not be positioned on any row. If rowno equals the value of the rowsCount property, the current row will change to the insert row. Any pending user input is first validated by this method. It returns true if successful. | |
Boolean | isCurrentRowNull() | Returns true if the row buffer contains null for each row. | |
Boolean | isInQueryMode() | Returns true if the data source is currently in query mode. | |
Boolean | isOnInsertRow() | Returns true if the current row is the insert row. | |
Boolean | isQueryModeSupported() | Returns true if the data source table supports query mode. | |
Boolean | refreshAndLockCurrentRow(Boolean keepCurrentChanges) | This method does the same thing as the refreshCurrentRow method. In addition, if the remote database supports it, the remote row that corresponds to the current row is locked so that other users cannot modify or delete it as long as the lock is held. See the descriptions of the IliTable::refreshAndLockRow method and the IliSQLTable class for more information on row locking.
This method returns true if successful. | |
Boolean | refreshCurrentRow(Boolean keepCurrentChanges) | If the underlying table is a two-tier table, this method re-reads the current row's values from the remote database. If the optional keepCurrentChanges parameter is given the value true , any columns of the data source that contain changes awaiting validation will not be re-read. Only unchanged columns will be updated. If keepCurrentChanges is false or if it is omitted, all columns are updated without regard to the "modified" state.
With a one-tier table, this method does nothing. This method returns true if successful. | |
Void | removeErrorSink(Object sink) | Removes an error sink. | |
Void | reportErrors(IliErrorList errorList) | Reports the errors that are in the error list. | |
Boolean | select() | Calls table.select() and then moves to the first row of the table. Any pending user input is canceled by this method. It returns true if successful. | |
Boolean | startInsert() | Changes the current row of the data source to the insert row if insertion is allowed. Any pending user input is canceled by this method. It returns true if successful. | |
Boolean | switchToQueryMode() | If query mode is supported, this method changes the data-source's table to a special memory table dedicated to contain query conditions. It returns true if successful. | |
Boolean | validate() | Validates the current row returning true if successful. Validation is carried out in the following manner:
- If the row buffer of the data source is unmodified, validation succeeds immediately.
- Otherwise, system defined constraints are checked on the current row buffer. If these constraints are not satisfied, validation fails.
- The
ValidateRow callback is called. It checks any application defined constraints and if these are not satisfied, it calls the dontValidateRow method. In this case, validation fails.
- One of the
PrepareInsert or PrepareUpdate callbacks is called depending on whether the current row is the insert row.
- A new row is then inserted into the underlying table depending on whether the current row is the insert row. If successful, one of the
QuitInsertMode or QuitUpdateMode callback is called and true is returned.
If successful, the current row is read back from the table, its values are copied into the data source's row buffer, and the inputModified property is set to false .
If this method fails, it shows any error messages to the user by calling the reportErrors method. | |
Boolean | validateSilently() | Performs validation in the same manner as the validate method but does not show error messages to the user. | |
Callback | CancelEdits | Called just after the edits in the current row have been cancelled. | |
Callback | DeleteRow | Called just before a row in the underlying table is deleted. The index of the row that is to be deleted can be obtained by looking at the deletedRow property. | |
Callback | EnterInsertMode | Called just after the current row buffer becomes modified when the current row is the insert row. | |
Callback | EnterModifiedState | Called just after the data source changes its state from "not-modified" to "modified". This typically happens when the end user starts modifying a field connected to the data source or when the setValue member function is called.
This callback can be used to check that it is possible to enter the modified state at the present time. If not, it calls the cancel member function.
Note that it would not be possible to use the EnterUpdateMode or EnterInsertMode callbacks for this purpose since they are called before the state of the data source changes (and hence calling cancel would not have any effect in this case). | |
Callback | EnterRow | Called just after a new row is entered. | |
Callback | EnterUpdateMode | Called just after the current row buffer becomes modified when the current row is not the insert row. | |
Callback | FetchRow | Called just after a new row has been retrieved from a remote database and cached in the underlying table. The index of the row that has just been fetched can be obtained by looking at the fetchedRow property.
Here is an example of a FetchRow callback:
var counter = 0;
function OnFetchRow(ds) {
var column = ds.COUNTER.tableColumn;
column.setInCache(ds.fetchedRow,
++counter);
}
Note how it uses the setInCache method of class IliTableColumn to store a value in the local row cache of the table object. | |
Callback | PrepareDeleteRow | Called when the user attempts to delete a row through the data source. The index of the row that is to be deleted can be obtained by looking at the deletedRow property.
The row deletion can be prevented by calling the dontDeleteRow method. In addition, the addErrorMessage member function may be called to describe the reason for the failure.
Here is an example of a PrepareDeleteRow callback:
function OnPrepareDeleteRow(ds) {
if (ds.deletedRow == 0) {
ds.dontDeleteRow();
ds.addError("Leaf node cannot be deleted.");
}
}
| |
Callback | PrepareInsert | Called when an attempt is made to validate the current row when the current row is not the insert row. This callback is called in addition to the ValidateRow callback. The row validation can be prevented by calling the dontValidateRow method. In this case, the addErrorMessage method should also be called to provide an error message to the user. Alternatively, it is possible to change some of the values in the current row before it is inserted in the underlying table. | |
Callback | PrepareUpdate | Called when an attempt is made to validate the current row when the current row is not the insert row. This callback is called in addition to the ValidateRow callback. The row validation can be prevented by calling the dontValidateRow method. In this case, the addErrorMessage method should also be called to provide an error message to the user. Alternatively, it is possible to change some of the values in the current row before it is updated in the underlying table. | |
Callback | QuitInsertMode | Called just after the current row has been successfully validated when the current row is the insert row. | |
Callback | QuitRow | Called just before the selection moves out of a row. | |
Callback | QuitUpdateMode | Called just after the current row has been successfully validated when the current row is not the insert row. | |
Callback | ValidateRow | Called when an attempt is made to validate the current row. The row validation can be prevented by calling the dontValidateRow method. In this case, the addErrorMessage method should also be called to provide an error message to the user. Alternatively, it is possible to change some of the values in the current row before it is transmitted to the underlying table. This callback is called when an existing row is being updated or when a new row is being inserted.
Here is an example of a ValidateRow callback:
function OnValidateRow(ds) {
var capacity = ds.CAPACITY.value;
var volume = ds.VOLUME.value;
if (volume > capacity) {
ds.dontValidateRow();
ds.addError("Volume must be less than Capacity");
}
else {
ds.LASTMODIF.value = new Date();
}
}
| |