beforeSearch Event

Arguments

eobject

An object that contains the following properties:

searchModestring

Indicates the search mode. Can be either 'search ' or 'clear' - user cleared existing Search Part filter.

searchWherestring

Indicates where the search will be performed. It is either 'clientside', or 'serverside'.

listIsDirtyboolean

Indicates if the List is dirty (has unsynchronized edits).

Description

Fires before the user submits the List's Search Part to execute a search of the records in the List.

Discussion

The beforeSearch event can be used to display a custom message before the user submits a client-side or server-side search. If the event returns false, Alpha Anywhere's system search messages will be suppressed. This is useful if you want to display your own custom message before the search is performed.

Example: Server-side Searching

If a List contains unsynchronized changes, a server-side search will not be performed by Alpha Anywhere. This is because the user may have changed records that would be returned in the search results from the server. The beforeSearch event can be used to notify the user that a search cannot be performed because they have unsynchronized changes in this situation:

if (e.searchWhere == 'serverside' && listIsDirty) {
    alert("Search cannot be performed until records have been sycnrhonized.");

    // Return false to suppress system error message:
    return false;
}

See Also