I need to provide my users with a method to save and reload sorting and grouping information between sessions. I can use the event arguments from the Sorted and Grouped events to get and then store the sorting and grouping information.
I can retrieve the previously stored sorting and grouping information from my user settings. How do I apply those settings to the grid? I.E., how do I sort and group programmatically?
Thanks.
hi,
is this working?
coz, i tried....
dg.FieldLayouts[0].SortedFields.Clear();
for (int i = 0; i < b.Length; i++){ Field fld = dg.FieldLayouts[0].Fields[b[i]]; FieldSortDescription fsd = new FieldSortDescription(); fsd.Field = fld; fsd.Direction = ListSortDirection.Ascending; fsd.IsGroupBy = true; dg.FieldLayouts[0].SortedFields.Add(fsd); for (int j = 0; j < pnlsearch.Children.Count; j++) { ((TextBox)(pnlsearch.Children[j])).Width = e.FieldLayout.Fields[j].LabelWidthResolved; }}
b is an array with all the saved group/sorted fields
any suggestion?
Found it. Never mind!
this.xamDataGrid1.FieldLayouts[0].SortedFields.Clear();this.xamDataGrid1.FieldLayouts[0].SortedFields.Add(deptSort);this.xamDataGrid1.FieldLayouts[0].SortedFields.Add(salarySort);
this