Same problem as reported here:
http://blogs.infragistics.com/forums/t/65104.aspx
In the code below I put a breakpoint in the sortcoupon method and observed it is never executed (plus, the data in the grid is not sorted). This was supposed to be fixed in 11.2. Am I doing something wrong?
FilterHelper.FlatDataSource.HierarchyDescriptors.Where(x => x.HierarchyName == "Collateral") .Single().LevelDescriptors[1].OrderByKeyExpression = (Expression<Func<ExposureItem, string>>) (x => x.Collateral);
FilterHelper.FlatDataSource.HierarchyDescriptors.Where(x => x.HierarchyName == "Type") .Single().LevelDescriptors[1].OrderByKeyExpression = (Expression<Func<ExposureItem, string>>)(x => x.Type);
//FilterHelper.FlatDataSource.HierarchyDescriptors.Where(x => x.HierarchyName == "Coupon")// .Single().LevelDescriptors[1].OrderByKeyExpression = (Expression<Func<ExposureItem, decimal>>)(x => x.Coupon);
FilterHelper.FlatDataSource.HierarchyDescriptors.Where(x => x.HierarchyName == "Coupon") .Single().LevelDescriptors[1].OrderByKeyExpression = (Expression<Func<ExposureItem, decimal>>)(x => SortCoupon(x));
protected decimal SortCoupon(ExposureItem e){ return e.Coupon;}
Hello Sam,
Could you look if this post will help you to resolve this issue. There Valerie has explained about how this functionality works.
Regards.Plamen.
Hello Plamen, I presume you are speaking of Valeries post on 2/23/12. Sorry but I dont understand how to actually implement that. I tried to add LevelDefaultSortDirections section to my Flat data source however it appears to have no effect. Perhaps because I'm not seeting DataSourceBase.PreserveMembersOrder?? I don't know where to set that. Below is my flat data source. I need to sort by Type, Coupon (columns) and Collateral, Account (rows) in ascending order. Can you give me a quick example of how I might do that?
Thanks again,Sam
<igFlatData:FlatDataSource x:Key="QtyFlatData" x:Shared="False" Rows="[Collateral].[Collateral],[AcctNo].[AcctNo]" Columns="[Type].[Type],[Coupon].[Coupon]" Measures="Qty" > <igFlatData:FlatDataSource.ConnectionSettings> <igFlatData:FlatDataConnectionSettings ItemsSource="{Binding Items}"/> </igFlatData:FlatDataSource.ConnectionSettings>
<igFlatData:FlatDataSource.CubesSettings> <igFlatData:CubeMetadata DataTypeFullName="Poolman.Models.ExposureItem"> <igFlatData:DimensionMetadata SourcePropertyName="Qty" DisplayFormat="{}{0:#,#;(#,#)}"/> </igFlatData:CubeMetadata> </igFlatData:FlatDataSource.CubesSettings>
<igFlatData:FlatDataSource.LevelDefaultSortDirections> <igFlatData:LevelSortDirection LevelUniqueName="Collateral" SortDirection="Ascending"/> <igFlatData:LevelSortDirection LevelUniqueName="Coupon" SortDirection="Ascending"/> </igFlatData:FlatDataSource.LevelDefaultSortDirections> <igFlatData:FlatDataSource.HierarchyDescriptors> <igFlatData:HierarchyDescriptor SourcePropertyName="Collateral" HierarchyName="Collateral" > <igFlatData:HierarchyDescriptor.LevelDescriptors> <igFlatData:HierarchyLevelDescriptor LevelName="All"/> <igFlatData:HierarchyLevelDescriptor LevelName="Description" LevelExpressionPath="Collateral" /> </igFlatData:HierarchyDescriptor.LevelDescriptors> </igFlatData:HierarchyDescriptor>
<igFlatData:HierarchyDescriptor SourcePropertyName="AcctNo" HierarchyName="AcctNo"> <igFlatData:HierarchyDescriptor.LevelDescriptors> <igFlatData:HierarchyLevelDescriptor LevelName="All"/> <igFlatData:HierarchyLevelDescriptor LevelName="AcctNo" LevelExpressionPath="AcctNo" /> </igFlatData:HierarchyDescriptor.LevelDescriptors> </igFlatData:HierarchyDescriptor> <igFlatData:HierarchyDescriptor SourcePropertyName="Coupon" HierarchyName="Coupon"> <igFlatData:HierarchyDescriptor.LevelDescriptors> <igFlatData:HierarchyLevelDescriptor LevelName="All"/> <igFlatData:HierarchyLevelDescriptor LevelName="Coupon" LevelExpressionPath="Coupon" /> </igFlatData:HierarchyDescriptor.LevelDescriptors> </igFlatData:HierarchyDescriptor>
<igFlatData:HierarchyDescriptor SourcePropertyName="Type" HierarchyName="Type"> <igFlatData:HierarchyDescriptor.LevelDescriptors> <igFlatData:HierarchyLevelDescriptor LevelName="All"/> <igFlatData:HierarchyLevelDescriptor LevelName="Type" LevelExpressionPath="Type" /> </igFlatData:HierarchyDescriptor.LevelDescriptors> </igFlatData:HierarchyDescriptor>
<igFlatData:HierarchyDescriptor SourcePropertyName="PM_Name" HierarchyName="PM_Name"> <igFlatData:HierarchyDescriptor.LevelDescriptors> <igFlatData:HierarchyLevelDescriptor LevelName="All"/> <igFlatData:HierarchyLevelDescriptor LevelName="PM_Name" LevelExpressionPath="PM_Name"/> </igFlatData:HierarchyDescriptor.LevelDescriptors> </igFlatData:HierarchyDescriptor>
<igFlatData:HierarchyDescriptor SourcePropertyName="DeliveryDate" HierarchyName="DeliveryDate"> <igFlatData:HierarchyDescriptor.LevelDescriptors> <igFlatData:HierarchyLevelDescriptor LevelName="All"/> <igFlatData:HierarchyLevelDescriptor LevelName="DeliveryDate" LevelExpressionPath="DeliveryDate" /> </igFlatData:HierarchyDescriptor.LevelDescriptors> </igFlatData:HierarchyDescriptor>
<igFlatData:HierarchyDescriptor SourcePropertyName="IsFail" HierarchyName="IsFail"> <igFlatData:HierarchyDescriptor.LevelDescriptors> <igFlatData:HierarchyLevelDescriptor LevelName="All"/> <igFlatData:HierarchyLevelDescriptor LevelName="IsFail" LevelExpressionPath="IsFail"/> </igFlatData:HierarchyDescriptor.LevelDescriptors> </igFlatData:HierarchyDescriptor>
</igFlatData:FlatDataSource.HierarchyDescriptors> </igFlatData:FlatDataSource>
FilterHelper.FlatDataSource.HierarchyDescriptors.Where(x => x.HierarchyName == "Coupon") .Single().LevelDescriptors[1].OrderByKeyExpression = (Expression<Func<ExposureItem, decimal>>)(x => x.Coupon);
FilterHelper.FlatDataSource.HierarchyDescriptors.Where(x => x.HierarchyName == "AcctNo") .Single().LevelDescriptors[1].OrderByKeyExpression = (Expression<Func<ExposureItem, decimal>>)(x => x.AcctNo);
Hi Sam,
You can find PreserveMembersOrder as property of FlatDataSource. Also if you prefer to use LevelDefaultSortDirections collection, then you have to specify the level's unique name – it should follow this format [DimensionName].[HierarchyName].[LevelName]
<olap:LevelSortDirection LevelUniqueName="[Date].[Date].[Years]" SortDirection="Descending"/>
Let me know if this works for you.
Plamen.