Wednesday, August 25, 2010

Custom pivot sorting

I will start this blog with an embrace to the genius architecture of DevExpress Xaf framework. As the time passes by and you get more experienced in using it you will soon realize that it has teach you to write so declarative code that almost 95% of it is reusable and should go to your base libraries or else to eXpand!!

So the new addition to eXpand has to do with custom pivot sorting .

Say that for a domain model similar to

image

you have design an analysis object using your win UI like

image

image

as you can see Xaf by default is going to sort your products by using the default property of the Product persistent object with is name .

But your client asked you to sort by the Sort property of Product which values can be controlled by him through the UI.

For that reason you could use eXpand.ExpressApp.PivotChart.PivotedProperty.PivotedSortAttribute in combination with eXpand.ExpressApp.PivotChart.PivotedProperty.PivotedPropertyAttribute similar to

[PivotedSort("Product.Name", SortDirection.Ascending,"Product.Sort")]

[PivotedProperty("NewPumpPrices", "Name='Web new pump price analysis'", "Site")]

public Analysis NewPumpAnalysis { get; set; }

 

[Browsable(false)]

public XPCollection<Price> NewPumpPrices {

    get { return PriceBuilder.GetNewPumpPricesWithNoTypeFromTransaction(Session); }

}

and then using also PivotGridOptionsView Settings

image

you could hide the grid headers

image

and by adjusting your layout using Model Editor you can produce a custom sorted web view exactly as your client asked you using only declarative programming approaches!!!

image

Isn't’ that wonderful for your work? If you still cannot think why this is imagine that using worldcreator even your client (no developer) can implement that scenario alone (of course with some guidance from you).

 

That is why i started this blog post with an embrace to Xaf, it just changes the way we used to think about applications!!!!!

Subscribe to XAF feed
Subscribe to community feed

DiggIt!
blog comments powered by Disqus