I have two problems (one may be a bug).
I would like to be able to programmatically groupby two columns and then sort the results by a third column. I am able to get the two columns to do the outlook groupby when the grid loads but the results when expanded are not being sorted by the third column.
In other words, I have Clinics which contain many Doctors (PCP in my code below) which have many Patients. When the grid loads I want to groupby Clinic and then Doctor and then display the PatientIDs in order. I can get the two Outlook groupbys to work but I can't get the PatientIDs to sort. Please see my code below and let me know if I'm missing anything to specify the correct groupby and sort.
Problem #2 arises when I try to export to Excel. When I have the groupby rolled up in the webgrid by Clinic and then Doctor, the Excel spreadsheet reverses the groupby column order, displaying the groupby rolled up by Doctor and then Clinic. If I reverse the order of the groupby columns in the webgrid to Doctor first and then Clinic, the Excel spreadsheet again reverses the column order and displays the groupby as Clinic and then Doctor. So I can't get the Excel export to match what's in the webgrid when I groupby two columns programmatically. Any idea how I fix this? It only happens when I set the groupby programmatically. If I comment out the below code and manually drag the columns to do the two-column groupby, the Excel export works as expected. Thanks...
The relevant code:
// Default to Grouping by Clinic & PCP and then sort by PatientIDthis.UltraWebGrid1.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.ViewType.OutlookGroupBy;int clinicIndex = getColumnIndex(ref this.UltraWebGrid1, "Clinic_value");int pcpIndex = getColumnIndex(ref this.UltraWebGrid1, "PCP_value");int patientIDIndex = getColumnIndex(ref this.UltraWebGrid1, "PatientID");UltraGridColumn clinicColumn = this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[clinicIndex];UltraGridColumn pcpColumn = this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[pcpIndex];UltraGridColumn patientIDColumn = this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[patientIDIndex];clinicColumn.IsGroupByColumn = true;pcpColumn.IsGroupByColumn = true;this.UltraWebGrid1.Bands[0].SortedColumns.Add(clinicColumn);this.UltraWebGrid1.Bands[0].SortedColumns.Add(pcpColumn);this.UltraWebGrid1.Bands[0].SortedColumns.Add(patientIDColumn);
Just run into this problem myself, but I have a workaround. It's not pretty, but it works. What you need to do is turn the grouping off on any grouped columns, call DataBind(), then group the columns again in reverse order, then call DataBind() again.
Pretty rank, but there you go...
However, no matter what I do, I can't seem to get the grouping back into the right order afterwards.
I didn't follow up on this because the UltraWebGrid didn't quite do what I needed it to do, so I went with another component. Here's the reply and sample project I received from support. Hopefully it helps...
Thank you for your support submission.Based on your description I have created sample application with build version Version=8.2.20082.1000. In this sample I have programmatically set two columns to be groupBy. I then set the third column to be sorted.I created a button to export to Excel. I tested this by changing the groupBy order and the Excel spreadsheet display the correct groupBy column order.I am attaching the sample application for your reference. Please run the sample application at your end and see if the behavior persists.Just in case your mail server does not allow .zip files, I have renamed the extension to .zop. Please reset the extension back to .zip at your end before opening the archive.
I have a similar problem. Can you please share your solution.
Thanks.
Sarita.
While Infragistics will provide assistance via our forums when possible, they are not meant as an avenue for official support. If you require official assistance from Infragistics, you should place a support request with Developer Support. My signature provides information on how to do so.In this specific situation, I see that you've recently submitted a support request, as incident number UWG30717. This incident is assigned to a Developer Support Engineer for research, though we don't have an answer available yet. I've asked the DSE to provide you with an update on Monday, assuming we don't have a solution available sooner.In general, standard support and trial support incidents usually entail a one- to three-business-day timeframe for response, though this can sometimes be longer depending on our current support volume.We also have a priority support service available with guaranteed turnaround times. For incidents submitted before 1 pm on a business day, a response is guaranteed by 5 pm the next business day. For incidents submitted after 1 pm on a business day, a response is guaranteed by 1 pm the next business day. All times are either US Eastern time or London time, depending on the support region on your incident.
56 hours and still waiting for a reply. Your support sucks.