Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Search API > Methods

Search API: getSearchObject

Scroll Prev Next More

 

Gets the SearchClause object.

Syntax

SearchClause::getSearchObject($table)

 

or for tables added to the dashboard

 

SearchClause::getSearchObject($table, $dashboard)

 

 

 

 

 

Arguments

$table

the name of the table. You can either use table name like "Categories" or "dbo.Categories". Also in AfterTableInitialized event you can use $table variable.

$dashboard

the name of the dashboard.

Return value

Returns the SearchClause object.

Examples

 

This code should go to AfterTableInit event. If search is not started apply the initial search conditions and only show products that belong to Beverages category.

 

$srchObj = SearchClause::getSearchObject("Products");
if(!$srchObj->searchStarted() ) {
  $srchObj->setFieldValue("CategoryName", "Beverages");
}

See also:

Example: Print search parameters on the List page

About Search API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software