Implementing a Custom Search Console
Implementing a Custom Search Console
The form panel can be used as a search console by setting the panel type="console" in AXVW. In this case the panel will be still represented as an
Ab.form.Form
object, but it will not display any existing database records.
At any time you can ask the
Form
to create an
Ab.view.Restriction
object based on current values entered by the user.
var restriction = this.searchConsole.getFieldsRestriction();
The restriction will contain clauses for all non-empty form fields. The clauses will use
op
field properties if they are set in AXVW.
You can then use the obtained restriction to refresh other view panels, send it to a workflow rule, or store as a controller data variable for future use.
// apply the restriction to a grid
this.requestGrid.refresh(restriction);
// apply the restriction to get records from a DataSource
var requests = this.requestDataSource.getRecords(restriction);
// store the restriction for future use
this.storedRestriction = restriction;
You can also modify the restriction, adding new clauses or changing existing ones.
var restriction = this.searchConsole.getFieldsRestriction();
restriction.addClause('wr.priority', '75', '>');
this.requestGrid.refresh(restriction);
To clear the search console values entered by the user and restore default values specified in AXVW:
this.searchConsole.clear();