Data Sources / Stored Procedures / Using Output Cache / Search Bars and Dialogs
Custom Search Dialog

Let’s create a confirmation data controller to allow selecting a Customer ID. The value will be passed to the enhanced output caching script as a parameter.

Click on the Home link in the bread crumbs displayed under the toolbar at the top of the Project Designer. Select Controllers tab and choose New | New Controller option on the action bar.

Create a new data controller in Project Designer of Code On Time web application generator

Enter the following properties and click OK button to create the controller.

Property Value
Controller Name CustOrderHist_Params

Right-click CustOrderHist_Params / Fields node in Project Explorer and select New Field option.

Adding a new field to a data controller in Project Exporer

Enter the new field properties as follows.

Property Value
Name CustomerID
Type String
Length 5
Label Customer
Items Style Lookup
Data Value Field CustomerID
Data Text Field CompanyName
Lookup window description Select a customer
Search by First Letter Yes

Click OK button to create the field.

The field node in the Project Explorer will look as follows.

The confirmation data controller with a single lookup input field in a Code On Time web application project

Now it is time to define a Search action in the output cache controller CustOrderHist_Cache . The action will display the confirmation data controller CustOrderHist_Params to a user and cause the CustOrderHist_Cache controller to refresh the data with the collected parameter CustomerID.

Right-click the CustOrderHist_Cache / Actions / ag5 (ActionBar) – Actions  node in Project Explorer and select the New Action option.

Adding a new action to an action group in Project Explorer of Code On Time web application generator

Enter the properties of the action and click OK button to save the changes.

Property Value
Command Name Search
Confirmation

_controller=CustOrderHist_Params
_width=500
_title=Select a Customer to View History
_shortcut=true

Click Browse on the Project Designer toolbar and navigate to Cust Order Hist Cache page.

The new action can be accessed under Actions option of the action bar.

Notice that the Search action has replaced the standard search bar activator icon on the left of the Quick Find on the action bar. The icon will activate the Search action.

If you click the refresh icon in the bottom right corner of the grid view then this will also activate the first available Search action.

Action 'Search' replaces the standard search bar activator icon located on the left side of the Quick Find on action bar

Activate the Search action with any of three methods listed above. The application framework will create a modal confirmation data controller.

A modal confirmation data controller activate to confirma 'Search' action

Select a customer in the lookup window.

Selecting a customer in lookup window with the 'Search by First Letter' feature enabled

Click OK button in “Select a Customer to View History” modal popup. This will confirm the Search action and will the pass the selected Customer ID to the output caching script.

Confirming an action with a modal confirmation data controller

The enhanced output caching script will detect that the parameter @Parameters_CustomerID is not null and will use its value as a filter.

The enhanced output caching script uses the value of @Parameters_CustomerID parameter as a filter