Hi,
I have a grid with both a fixed Grouping (the user doesn't change the grouped column) and a default sort order. Let's call the Grouping field FieldA and the default sort order FieldA + FieldB. I haven't found a way to apply the default sort order after the Grouping has occurred. The data returned to the control is initially sorted by FieldA + FieldB, but with the grouping that sorting is gone by the time the page renders (the data is grouped as I expect). I can have Javascript restore it, but that requires another trip back to the server. What do you think?
Ross Bailey
Hi Ross,
It has been some time since you posted, but in case you still need assistance I will be glad to help.
You would not be able to group and then sort by the same column – grouping by FieldA for example, would also apply sorting by this column. You could set the sorting direction when applying default grouping:
protected void Page_Load(object sender, EventArgs e)
{
WebHierarchicalDataGrid1.GroupingSettings.GroupedColumns.Add("FieldA", GroupingSortDirection.Descending);
}
Then you could sort by FieldB in RowIslandDataBinding event:
Sorting sort = e.RowIsland.Behaviors.Sorting;
sort.SortedColumns.Add("FieldB", Infragistics.Web.UI.SortDirection.Descending);
Let me know if you have any further questions.
Hello Ross,
If you need any further assistance on the matter please do not hesitate to ask.
Thank you, your suggested solution helped.