Dennis (DevExpress Support)
07.02.2008
1 Solution
There are different ways to provide this functionality for the Windows and ASP.NET parts of your XAF solution.
Windows Forms
You can provide this functionality either via a couple of buttons (Select All/Unselect All) in the toolbar (using a ViewController with two SimpleAction) or yet better implement an unbound selection column directly in the grid control. These approaches were demonstrated in the following Code Central examples:
How to use an unbound check box column to select grid rows
Multiple selection using checkbox (web style)
To implement these solutions for the XtraGrid in XAF, refer to the Access Grid Control Properties in Windows Forms Applications help topic.
A similar approach should be used for the XtraTreeList control.
ASP.NET
This feature is already supported by the ASPxGridListEditor and ASPxTreeListEditor. You can use a check box in the column header of the grid control. This functionality is controlled by the ShowSelectionColumn property:
-
Your solution stops short in explaining how to actually accomplish this using actions. Specifically, once the actions are defined in a controller, how can one change the properties of the objects associated with the rows in the list view, in this case setting a non-persistent Boolean to true or false? It is frustrating that such a seemingly simple task (accessing the associated objects in a list view's controller) end up being so complicated: using ListView.CollectionSource.List is particularly non-obvious.
My ultimate goal would be a controller that adds the "Select All" and "Clear Selection" actions via code, only for list views that show objects with a "Selected" property of type Boolean. Any examples on how to conditionally add actions based on whether a property of a specific name and type is present or not?
It seems non-persistent changes are not "global" while the application is running. Specifically, I need to run reports that only show data from the selected rows, but records are fetched anew from the server when running reports, thus requiring a persistent property to select rows.
Facebook
Twitter
Google+