How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows
- 3 minutes to read
If you have already run a Windows Forms or ASP.NET application, you might notice that Lookup Property Editors, which display reference properties, contain a list of existing objects of the specified type in the drop-down menu. Similarly, the Link Action's pop-up window displays a list of available objects of the specified type. The following image demonstrates both the Lookup Property Editor's drop-down window and the Link Action's pop-up window:
However, this approach to simultaneously show all objects, is not appropriate when there are many objects to be shown. So, the eXpressApp Framework supplies a built-in Search functionality. This topic details how to turn it on.
The Search functionality is activated in all Mobile applications and in WinForms and ASP.NET applications when a List View in a Lookup Property Editor or Link Action's pop-up window contains more than 25 objects by default. You can change this number. For this purpose, use the IModelOptions.LookupSmallCollectionItemCount property of the Application Model's Options node.
This property specifies the minimum count of objects that should be in a List View to activate the Search functionality.
The Search functionality is provided by an editor and the Search button:
This button executes the FilterController.FullTextFilterAction Action of the FilterController. This Action filters the List View's collection source, searching the objects whose properties' string representation includes the value specified by an end-user. The properties include those that are listed in the Views | <ListView> node defining the List View - no matter visible or invisible, persistent or non-persistent. For details, refer to the FilterController class description.
You can have the Search functionality available in the Lookup Property Editor or Link Action's pop-up window when any number of objects are contained in the List View's collection source. For this purpose, apply the LookupEditorModeAttribute to the required property (a reference of collection property). Using this attribute, you can set one of the following modes for the corresponding Lookup Property Editor or Link Action's pop-up window:
The Search feature is added if the presumed object count in its data source collection is greater than the value of the LookupSmallCollectionItemCount attribute.
All objects of the specified type are loaded.
None of the existing objects of the specified type are loaded, and the Search feature is available.
All objects of the specified type are loaded, and the Search feature is available.
To set the required mode, pass the corresponding value as the LookupEditorModeAttribute's parameter. Alternatively, you can use the Model Editor. The value of the LookupEditorMode atribute's mode parameter is set for the LookupEditorMode property of the BOModel | <Class> | OwnMembers | <Member> node.
If the LookupEditorModeAttribute attribute is not used, the Lookup Property Editor is displayed in the Auto mode.