Hi,
How can I change a PivotDataColumn's ordinal in the list of PiotDataColumns?
For example, in the following picture, I want to programmatically move PivotDataColumn LME_NICKEL to the first position.
Thanks
Sangeetha
Hello,
By design the members are created in the order of their appearance in items source and they are displayed in such order as well. So if you want to ensure that your members have given default order you have to order your items source in appropriate order.
Also here is described how you can set the rules about how your members are ordered when header sorting is allowed.You need to create an hierarchy descriptor over the property used as a source property of this particular dimension. Have a look at the code below:
HierarchyDescriptor<ProductData> daysOfMonthDescriptor = new HierarchyDescriptor<ProductData>(pd => pd.Date);
daysOfMonthDescriptor.HierarchyName = "Days Of Month";
// uncomment in order to have a root level
// daysOfMonthDescriptor.AddLevel(pd => "All Days Of Month", "All");
daysOfMonthDescriptor.AddLevel(pd => pd.Date.DayOfMonth(), "Days Of Month");
// provides the right items order based on their numeric values
Expression<Func<ProductData, int>> orderByExpression = d => d.Date.DayOfMonthOrderKey();
daysOfMonthDescriptor.LevelDescriptors[1].OrderByKeyExpression = orderByExpression;
flatDataSource.HierarchyDescriptors.Add(daysOfMonthDescriptor);
This code illustrates how Days of month hierarchy can be created. Because we want members to appear in right numeric (not string) order we set OrderByKeyExpression property to be an integer which refers to the position of each day.
As order by key you can use the value returned by a property of your data class or you can make a call to an instance or extension method which have to return the value used to determine the column ordinal.
Best regards.
Plamen.
Hi Plamen,
My items source is properly ordered. But somehow the grid shows sorted view. It seems to be automatically sorting it. How can I turn sorting off for a particular PivotHeadercolumn/PivotHeaderRow?
Sorted order was the original behavior which 11.1 was released with. With the first service release of 11.1 we have fixed this so that all members to appear in their natural order. So I think you have to get service release binaries.
Best regards.Plamen.
Do you mind giving me a link to the latest Service release please.
Hello Sangeetha,
You can find the latest service release under your account at the Infragistics Website. To download the service release, log in to
‘My IG’ and select ‘Keys & Downloads’. Select the appropriate tab for this product; then the license key. The available service releases (Hot Fixes) should be listed on the page.
If you have any further questions on this, please feel free to ask.
Thanks Elena. I downloaded it last night.