listObj.searchList Method




optionsJSON object

An optional JSON format string that indicates where the search should be performed (client-side or server-side). In the case of server-side search, you can set additional optional properties (listed below)

searchMode Character

Can be set to 'clientSide', 'serverSide' or 'auto'. The 'auto' option performs a server-side search if the List is not 'dirty' (i.e. does not have any unsynchronized edits). Otherwise, it performs a client-side search.


In the case of a server-side search, indicates the maximum number of rows that the search is allowed to return. This property overrides the property that is set in the List Builder on the Search Part pane.


In the case of a server-side search, indicates the maximum payload that the search is allowed to return. This property overrides the property that is set in the List Builder on the Search Part pane.


Defines the name of an Xbasic function that will be called after the filter has been computed, but before the SQL has been executed. See "Server-side After Search Expression Computed Event" below for more information.


Submits the Search Part to search the List. You can specify if the search should be performed client-side, server-side or 'auto'.


The searchList() method reads the search criteria from the Search Part for a List control and then performs either a client-side or server-side search. Additional options can be specified to defined the search behavior, including the search mode and the amount of data to return (rows, payload size).

var listObj = {dialog.object}.getControl("LIST1");

if (listObj) {
    listObj.searchList({searchMode : 'auto', maxRows: 30});
The List control's beforeSearch client-side event fires before the search is performed. This event exposes the searchWhere property that tells you where the search will be performed.

An optional Xbasic function can also be specified. This Xbasic function will be called prior to submitting the search on the server. The Xbasic function is not used for client-side searches.

Server-side After Search Expression Computed Event 

The Grid component exposes a server side event, onSearchPartFilterCompute, that can be used to override the computed search filter for the component. This event fires before the actual search query is executed.

The xbasicAfterFilterCompute property can be used to accomplish the same thing for a List control. The property can be used to specify an Xbasic function to call after the filter for the List has been computed but before any records are retrieved from the List's data source.

The Xbasic function specified must take e as a parameter. The e object contains the following properties:

  • e.tmpl - a pointer to the UX Component definition
  • e.searchDefinition - an object with properties defining the filter expression computed by Alpha Anywhere from the submitted dat.

The e.searchDefinition is a property array with the following properties:

e.searchDefinition Property

The values for the arguments used in the filter expression. Syntax is a CR-LF delimited string with syntax for each line as: searchValue|||field_type|argument_name


The SQL Where clause to be added to the base SQL query for the List.


The SQL order clause.


The SQL having clause.


Used in geography searches.

The Xbasic function can modify any of the properties for the e.searchDefinition object to customize the search filter. For example, the code below overwrites the search parameters and filter to only search for records with a Country of 'UK':

function customizeListSearch as v (e as p)
    dim parameters as c = "%UK%|||C|search_country_country1"
    dim filter as c = "(Country LIKE :SEARCH_Country_Country1)"

    e.searchDefinition.parameters = parameters
    e.searchDefinition.filter = filter

end function

To call the Xbasic function as part of the List search process, the xbasicAfterFilterCompute option is used. The xbasicAfterFilterCompute option defines an Xbasic function that should be called to process the search filter before querying the Lists data source. For example:

var listObj = {dialog.object}.getControl('LIST1');

if (listObj) {


List Control with Search Part

See Also