Hi all,
We are using WebHierarchicalDataGrid version 2010.3 2046 with EnableColumnGrouping="True".
There are two columns - ShipDate (type = Date) and InvoiceNumber (type = Int)
The DataSource is initial sort by ShipDate (DESC) and InvoiceNumber (DESC)
The grid is grouped by month and year of ShipDate as below:
September, 2010
12 09/10/2010
10 09/10/2010
13 09/10/2010
09 09/09/2010
The group is working fine and the Grid is initial sort by ShipDate but not sort by InvoiceNumber DESC as expected.
With above example, the expected result is:
How can we set the default sort in group from the Grid as ShipDate DESC, InvoiceNumber DESC ?
Thanks you,
Nguyen Huu Chu - VNETSOFTWARE
Ok I solved this problem. I'm not sure if there are other ways of doing this but this works for me.
First, remove any grouping and sorting from the mark up of you page - it all needs to happen in the code behind.
In the Page_Load event add your grouping, then create a new sorting behavior on the Gridview of the whdg not the object itself. Bingo!
if (!IsPostBack)
{
whdgClientHistory.GroupingSettings.EnableColumnGrouping = Infragistics.Web.UI.DefaultableBoolean.True;
whdgClientHistory.GroupingSettings.GroupAreaVisibility = Visibility.Hidden;
whdgClientHistory.GroupingSettings.GroupedRowTextMask = "{1}";
whdgClientHistory.GroupingSettings.GroupedColumns.Add("YourGroupField");
//Add default sort
Sorting sort = whdgClientHistory.GridView.Behaviors.CreateBehavior<Sorting>();
sort.Enabled = true;
sort.SortedColumns.Add("YourSortField", Infragistics.Web.UI.SortDirection.Descending);
}
I'm having exactly the same issue. Anyone know if this can be achieved?
I'm sorting my datasource before binding by primary and secondary id, where the primary id is the column being grouped. It seems the grouping operation is somehow re-ordering the records.