I've got a grid that I've applied a grouping to - by setting the FieldLayout's SortedFields.
See example code below.
The SortedFields are applied correctly - can see that the groupings are applied in the grid, but on clicking the expander, can't see any of the groupings in the group by area. If you then click on column "Test 2" to sort by it, then "Test 1" grouping appears in the group by area.
I think it's an ordering issue
1) Set DataSource 2) Set Fields 3) Set SortedFields - works fine
1) Set DataSource 2) Set SortedFields 3) Set Fields - the symptoms above occur
1) Set SortedFields 2) Set DataSource 3) Set Fields - the symptoms above occur
1) Set Fields 2) Set SortedFields 3) Set DataSource - works fine
The docs for 12.1 say that when populating SortedFields, if the field is not present then an exception is thrown. I can't seem to find any docs saying that's the case for 14.1, an exception isn't thrown, but the current behavior isn't 100% if the SortedFields are set before the Fields are populated.
(Sorry for the formatting - I don't have permission to upload attachments, and I can't see an option to paste code in your editor - the formatting should be OK if copy and paste into Visual Studio)
MainWindow.xaml:
<igWPF:XamDataGrid x:Name="grid"> <igWPF:XamDataGrid.FieldLayoutSettings> <igWPF:FieldLayoutSettings AutoGenerateFields="False" HeaderPlacementInGroupBy="OnTopOnly"></igWPF:FieldLayoutSettings> </igWPF:XamDataGrid.FieldLayoutSettings> <igWPF:XamDataGrid.FieldSettings> <igWPF:FieldSettings AllowEdit="False" CellClickAction="SelectCell" AllowGroupBy="True" /> </igWPF:XamDataGrid.FieldSettings> </igWPF:XamDataGrid>
MainWindow.xaml.cs:
public partial class MainWindow { public MainWindow() { InitializeComponent();
Loaded += MainWindow_Loaded; }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { SetDataSource();
SetSortedFields();
SetFields(); }
private void SetFields() { if (grid.DefaultFieldLayout == null) { grid.FieldLayouts.Add(new FieldLayout()); }
// NOTE: This line is necessary for the sorted fields to be applied if set // before fields grid.DefaultFieldLayout.Fields.Clear();
grid.DefaultFieldLayout.Fields.Add( new Field { Name = "Test1", Label = "Test 1" });
grid.DefaultFieldLayout.Fields.Add( new Field { Name = "Test2", Label = "Test 2" }); }
private void SetSortedFields() { if (grid.DefaultFieldLayout == null) { grid.FieldLayouts.Add(new FieldLayout()); }
grid.DefaultFieldLayout.SortedFields.BeginUpdate(); grid.DefaultFieldLayout.SortedFields.Add( new FieldSortDescription("Test1", ListSortDirection.Ascending, true)); grid.DefaultFieldLayout.SortedFields.EndUpdate(); }
private void SetDataSource() { grid.DataSource = new List<ItemVm> { new ItemVm {Test1 = "A", Test2 = 1.0}, new ItemVm {Test1 = "B", Test2 = 2.0}, new ItemVm {Test1 = "A", Test2 = 3.0}, }; } }
public class ItemVm { public string Test1 { get; set; } public double Test2 { get; set; } }
Hello Gary,
Thank you for your post. I have been looking into it and I tested your scenario with both the RTM (14.1.20141.1015) and latest (14.1.20141.2192) service release of version 14.1 and everything seems to work ok on my side. Could you please tell me the exact version you are using?
Looking forward for your reply.
Thanks for looking into this.
My version is 14.1.20141.1015
When you expand out the XamDataGrid's Group By box, are you saying that you see "Test 1" in there? Strange - we're seeing this on numerous machines, and with previous Infragistics releases.
No matter what is the order of setting sorted fields, data source and fields, I am able to see the grouped Field in the GroupByArea. Could you please send us a screenshot of the result you get and more deatails about your environment: OS and VS version, screen resolution, etc.?
See the attached image - notice that the rows are correctly grouped, but that "Test 1" is not showing in the Group By area.
My machine: Running Windows 7 64 bit, Visual Studio 2012 Update 4. Screen resolution 1280 x 1024.
Though it is occurring on various other machines.
Thanks
Just to make it clear, this second screenshot is what's seen after clicking on the "Test 2" button to sort by it. Doing this gets the grid to realize that it actually has a grouping by "Test 1" and it gets displayed in the Group by pane.
oops, I meant "click on the Test 2 COLUMN HEADER"
Could you please try to install the latest service release of version 14.1 and see if the issue still occurs. You can download the Service Releases by logging to our web site and going to Account \Keys & Downloads.
https://www.infragistics.com/my-account/keys-and-downloads/
Hi Stefan,
I'm on a trial license so I don't see any service releases on that page. Strange that you're not seeing the issue here when using the 14.1 initial release...
Thanks,
Gary
I can suggest you uninstall the NetAdvantage and install it again, but when you open the installer before you click install, look for a checkbox saying "Always download and install the latest service release", when you check it the new installation will be of the latest SR, but please check again when you open your solution.