Scenario:
When a user executes a navigation item that displays a large ListView, the application should display a popup window that allows you to define a filter for this ListView before loading records in it. This filter dialog should remember the user's choice and provide the capability to select one of the stored filters.
Steps to implement:
1. Create a ListView model extender - IModelListViewExt - that adds the AdditionalCriteria property to the ListView model to store the filter selected by the user.
2. Implement the ViewFilterContainer class whose DetailView is used as a filter dialog.
3. Implement the ViewFilterObject class which is used to store filters.
4. Implement the ShowFilterDialogController which shows the filter dialog instead of displaying the ListView, and then shows the filtered ListView. To do this, subscribe to the ShowNavigationItemController.ShowNavigationItemAction.Execute event and replace the ListView from the e.ShowViewParameters.CreatedView property with the ViewFilterContainer DetailView. Then show the filtered ListView via the XafApplication.MainWindow.SetView method.
5. Implement the NewViewFilterObjectController which sets the ObjectType property of the ViewFilterObject object created by the ViewFilterContainer.Filter lookup's New action.
See Also:
How to: Use Criteria Property Editors
How to: Extend the Application Model and Schema
ShowNavigationItemController Class
Dialog Controller
Question Comments
Added By: Pablo Mazaeda 1 at: 11/13/2012 6:21:47 AM
how do I do this for ASP.NET?
Added By: Mandeep Singh 10 at: 2/16/2014 6:57:38 AMTried to download this Example. Returns the following error
Server Error in '/Support/Center' Application.
Added By: Anatol (DevExpress Support) at: 2/16/2014 11:49:17 PMThis was likely a temporary issue. Please try to download the example once again.
Added By: Wieland Voß at: 3/4/2014 1:16:39 AMHi Anatol,
how do we implement this solution for the asp.net environment? Simply importing DevExpress.ExpressApp.Web in ViewFilterContainerDetailViewController doesn't seem to meet our needs, since LookupPropertyEditor and LookupEdit are unknown.
Thank you
Wieland
I have updated the example. Now its code is platform-independent and will work correctly in the ASP.NET project.
Added By: Wieland Voß at: 3/5/2014 7:32:50 AMThank you for your quick answer!
The implementation works fine, but ,unfortunately, is way too slow in web-modus :(
It seems, that the generation of large lookup-lists (millions) during filter-creation takes a lot of time. Do you have any hint, how to prevent this behaviour?
This is working great, but everytime I click a navigation item it creates a new "Default" filter. I'm using Web Application, would this matter?