Data comes in all shapes and sizes and businesses want to look at it from all the different angles. Luckily DevExpress has a number of different components to help you do just that. Previously, I examined the difference between grouping versus pivoting with our grids. To make things even easier for you, in V2010 Vol 2 XAF will introduce two new ListEditors, they are: Chart and PivotGrid.
Previously, to show data in a PivotGrid, you had to create an Analysis module. Well not anymore! As of V2010.2 it will be possible to show any collection in a PivotGrid or Chart by changing the editor for a ListView and customizing it, if needed.
Let's create a view that will show us a collection of Order objects in a PivotGrid. We'll use the FeatureCenter application as an example.
Open the ModelEditor and navigate to the Order_ListView view. Select WinPivotGridListEditor in the EditorType dropdown:
Select the PivotSettings node, and open the wizard by clicking on the ellipsis button for Settings attribute:
The PivotGrid designer is opened. Using this designer, we are able to completely customize the PivotGrid. Let's create PivotGrid fields for the necessary properties by double clicking on a property name in the Field List. First, let’s add a Freight field:
We also need three more fields that are not listed in the Field List: Employee.FullName, Customer.Country, Customer.City and Customer.CompanyName. Let's create them manually, by clicking the Add button, and selecting FieldName:
Now we can layout the grid. Navigate to the layout and move the Freight field to the data area, Employee field to the Column area and Customer.Country, Customer.City and Customer.CompanyName to the RowArea:
Let's return to the Fields section and correct the captions to avoid dots in field names:
We can now close the wizard and save the model. Note that the Settings attribute contains the entire configuration we created, stored in XML format:
The FeatureCenter does not show this Orders view in the navigation by default, so let's add the corresponding navigation item:
Now we can see the view in action. Save the model and run the application. This is what our orders view looks like in the PivotGrid:
And sales in the as a chart:
And of course, this all works in ASP.Net XAF applications too:
That’s all for this post, until next time, happy XAFing! :-)