Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to search for objects by using all the properties or by using more complex criteria

$
0
0

This example provides a possible workaround for the Filtering - Support searching objects by a string through all the properties (or a set of properties) or by more complex criteria suggestion.
The Dennis.Search.Win module, shown in the example, provides API to create a non-persistent object that can be used to search by properties of a business class. Such a non-persistent search-object should implement the ISearchObject contract. By default, it's supported by the abstract and generic SearchObjectBase class in the module. Search-objects are shown in a Detail View with the help of the SearchObjectViewController. To compose a search criteria, a specific SearchObjectPropertyEditor is used (it contains the Search and Clear buttons).
An example use of the implemented module is illustrated in the WinSolution.Module.Win module. There is a ProductSearchObject class that is inherited from the base SearchObjectBase class. If necessary, you can create several search objects for one business class. In UI, all search objects will be listed in a drop-down list in the toolbar of a View of your business class. Download and run the attached example to see how this works in action.
(Take special note of the SearchObjectBase class implementation, because it asynchronously loads search results of a specific type from the data store into the Search Results nested List View.)

Note that if you are implementing this functionality in ASP.NET, it is necessary to set the WebApplication.CollectionsEditMode property to Edit. Otherwise, the search results will not be displayed.

 

See Also:
How to allow users to create filter via the criteria editor before previewing a report
How to use Criteria Property Editors

Question Comments

Added By: Taradanov at: 6/17/2012 8:28:29 AM    

Can you provide Web editor for this example, please?

Added By: Gavin Lipeng Ma at: 3/20/2013 7:50:39 PM    

Also need a web solution.Could you please provide a web solution for this ?

Added By: kenngo at: 5/30/2014 10:49:42 PM    

The SearchObjectBase[Product]_SearchResults_ListView in the Model Editor is autogenerated? How is the search result link to this view?

Added By: Dennis (DevExpress Support) at: 6/2/2014 2:34:35 AM    @kenngo: Yes, it is auto-generated by XAF. This is a nested ListView node, which corresponds to the SearchResults collection property of the SearchObjectBase class, which is used to display results in the UI.

Viewing all articles
Browse latest Browse all 7205

Trending Articles