We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom datagrid group header

Thread ID:

Created:

Updated:

Platform:

Replies:

142947 Feb 26,2019 03:59 PM UTC Mar 1,2019 06:10 AM UTC Xamarin.Forms 5
loading
Tags: SfDataGrid
Paul Dietz
Asked On February 26, 2019 03:59 PM UTC

Is it possible to create a custom datagrid grouping header similar to the datasource GroupDescriptors for the listview?  Please see the highlighted code in the view model class below. 



I would like to display the TestTypeShortDescrption in the grouping header rather then the TestTypeID.


Subburaj Pandian Veluchamy [Syncfusion]
Replied On February 27, 2019 12:36 PM UTC

Hi Paul, 
 
Thank you for contacting Syncfusion support. 
 
Based on the provide information, your requirement of “Displaying the Group header description based on the given condition” can be achieved using the ISummaryAggregate and setting value to the CaptionSummaryRow.  
 
We have prepared sample for the same, please find the sample by the following link. 
 
Sample link: GridGroupSummarySample 
 
In the sample, we have displayed the group items count and date based on the group item values. 
 
You can refer regarding the same in our user guide documentation by the following link, 
 
 
We hope this helps. Please let us know, if you have any query. 
 
Regards,
Subburaj Pandian V  
 


Paul Dietz
Replied On February 27, 2019 05:38 PM UTC

Thank you for the reply to my question.   The sample code provided was not of much help, but a customaggregate may work.  Do you have any example code of returning a child string.  The function needs to return the child testypeinfo short desc of the parent testinfo based on testtypeid.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On February 28, 2019 01:01 PM UTC

Hi Paul, 
  
Thank you for update. 
  
We checked your requirement “How to display another column detail in caption summary row” and prepared sample based on your requirement. We have Grouped OrderID column and displayed Cutomer Column details in caption summary row. Please refer the following code snippet for your reference, 
  
[C#] 
dataGrid.GroupColumnDescriptions.Add(new GroupColumnDescription() 
{ 
    ColumnName = "OrderID" 
}); 
  
GridSummaryRow summaryRow = new GridSummaryRow(); 
summaryRow.Title = "Short Description : {CaptionSummary}"; 
summaryRow.ShowSummaryInRow = true; 
summaryRow.SummaryColumns.Add(new GridSummaryColumn 
{ 
    Name = "CaptionSummary", 
    // Defining Custom Aggregate. 
    CustomAggregate = new CustomAggregate(), 
    MappingName = "OrderID", 
    Format = "{CustomString}", 
    SummaryType = Syncfusion.Data.SummaryType.Custom 
}); 
dataGrid.CaptionSummaryRow = summaryRow; 
  
  
// Aggregate class. 
public class CustomAggregate : ISummaryAggregate 
{ 
    public CustomAggregate() 
    { 
    } 
  
    public string CustomString { getset; } 
  
    public Action<System.Collections.IEnumerable, string, PropertyInfo> CalculateAggregateFunc() 
    { 
        return (items, property, pd) => 
        { 
            var enumerableItems = items as IEnumerable<OrderInfo>; 
            if (pd.Name == "CustomString") 
            { 
                var value = enumerableItems.First<OrderInfo>().Customer; 
                var count = enumerableItems.Count(); 
                this.CustomString = value.ToString() + "-" + count + " Items"; 
            } 
        }; 
    } 
} 
  
We have also prepared sample and attached in following reference. 
  
  
We hope this helps. Please lets us know, if you need further assistance. 
 
Regards,
Subburaj Pandian V
 


Paul Dietz
Replied On February 28, 2019 07:58 PM UTC

Hi Paul, 
  
Thank you for update. 
  
We checked your requirement “How to display another column detail in caption summary row” and prepared sample based on your requirement. We have Grouped OrderID column and displayed Cutomer Column details in caption summary row. Please refer the following code snippet for your reference, 
  
[C#] 
dataGrid.GroupColumnDescriptions.Add(new GroupColumnDescription() 
{ 
    ColumnName = "OrderID" 
}); 
  
GridSummaryRow summaryRow = new GridSummaryRow(); 
summaryRow.Title = "Short Description : {CaptionSummary}"; 
summaryRow.ShowSummaryInRow = true; 
summaryRow.SummaryColumns.Add(new GridSummaryColumn 
{ 
    Name = "CaptionSummary", 
    // Defining Custom Aggregate. 
    CustomAggregate = new CustomAggregate(), 
    MappingName = "OrderID", 
    Format = "{CustomString}", 
    SummaryType = Syncfusion.Data.SummaryType.Custom 
}); 
dataGrid.CaptionSummaryRow = summaryRow; 
  
  
// Aggregate class. 
public class CustomAggregate : ISummaryAggregate 
{ 
    public CustomAggregate() 
    { 
    } 
  
    public string CustomString { getset; } 
  
    public Action<System.Collections.IEnumerable, string, PropertyInfo> CalculateAggregateFunc() 
    { 
        return (items, property, pd) => 
        { 
            var enumerableItems = items as IEnumerable<OrderInfo>; 
            if (pd.Name == "CustomString") 
            { 
                var value = enumerableItems.First<OrderInfo>().Customer; 
                var count = enumerableItems.Count(); 
                this.CustomString = value.ToString() + "-" + count + " Items"; 
            } 
        }; 
    } 
} 
  
We have also prepared sample and attached in following reference. 
  
  
We hope this helps. Please lets us know, if you need further assistance. 
 
Regards,
Subburaj Pandian V
 


Added test type description to the test info collection, so the grouping now shows the test type description.  



Subburaj Pandian Veluchamy [Syncfusion]
Replied On March 1, 2019 06:10 AM UTC

Hi Paul,  
  
Thank you for the update. We are happy that the given solution meets your requirement. 
 
Please let us know, if you need any further assistance.  
 
Regards,
Subburaj Pandian V  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon