Hi,
I have a custom group sorter and it works correctly, my issue is I would like to order the Group Rows.
I can do this as shown by placing the numbers 1,2,3, in my Converter. Is there a cleaner way where the number is not displayed ?
Also in this example is it possible to remove the Column name ?
for. eaxmple as per pic attached group would read "Cert Soon No Date Yet - 1 Item" rather than "Status: 1 ......"
Thanks Peter
___________________________________________________________________________________
public class GroupConverter : IValueConverter
{
public GroupConverter()
{
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var h = value as HistoryItem;
if(h.Status =="Complete")
{
return "6. Complete";
}
else
{
if(h.AuditDate.Date==DateTime.Now.Date)
{
return "3. Audit Today";
}
else if(h.AuditDate.IsBefore(DateTime.Now)&&h.AuditDate.IsAfter(DateTime.Now.AddYears(-10)))
{
return "5. Audit Done Waiting for Certification";
}
else if(h.AuditDate.IsAfter(DateTime.Now))
{
return "4. Audit Soon";
}
else if (h.CertExpiry.IsBefore(DateTime.Now.AddDays(14)))
{
return "1. Cert Soon No Date Yet";
}
else
{
return "2. No Date";
}
}
}
__________________________________________________________
<dataTable:SfDataGrid x:Name="dataGrid" AutoExpandGroups="False" ItemsSource="{Binding HistoryItems}" AllowGroupExpandCollapse="True" AutoGenerateColumns="True" ColumnSizer="Star" AllowResizingColumn="True" AllowSorting="True" BackgroundColor="Transparent">
<dataTable:SfDataGrid.Columns x:TypeArguments="syncfusion:Columns" >
<dataTable:GridTextColumn HeaderText="ID"
MappingName="ClientNum" HeaderFontAttribute="Bold"/>
<dataTable:GridTextColumn HeaderText="Name"
MappingName="ClientName" HeaderFontAttribute="Bold" LineBreakMode="WordWrap" MinimumWidth="75"/>
<dataTable:GridDateTimeColumn HeaderText="Audit"
MappingName="AuditDate" HeaderFontAttribute="Bold" Format="dd/MM/yy"/>
<dataTable:GridDateTimeColumn HeaderText="Call"
MappingName="CallDate" HeaderFontAttribute="Bold" Format="dd/MM/yy"/>
<dataTable:GridDateTimeColumn HeaderText="Cert"
MappingName="CertExpiry" HeaderFontAttribute="Bold" Format="dd/MM/yy" />
<dataTable:GridTextColumn HeaderText="Status"
MappingName="Status" LineBreakMode="WordWrap" HeaderFontAttribute="Bold"/>
</dataTable:SfDataGrid.Columns>
<dataTable:SfDataGrid.GridStyle>
<dataTable:DefaultStyle HeaderBackgroundColor="ForestGreen" HeaderForegroundColor="White"
RowBackgroundColor="White" RowForegroundColor="Black"
SelectionBackgroundColor="LightSkyBlue" SelectionForegroundColor="White"
CaptionSummaryRowBackgroundColor="LightGray" CaptionSummaryRowForegroundColor="Black"
GridCellBorderColor="Black" LoadMoreViewBackgroundColor="Gray"
LoadMoreViewForegroundColor="Black" AlternatingRowColor="Beige"/>
</dataTable:SfDataGrid.GridStyle>
<dataTable:SfDataGrid.GroupColumnDescriptions>
<dataTable:GroupColumnDescription ColumnName="Status"
Converter="{StaticResource groupConverter}" />
</dataTable:SfDataGrid.GroupColumnDescriptions>
</dataTable:SfDataGrid>
Attachment: Capture_9d70c051.rar
Hi Peter ,
#Regarding "remove numbers from the caption summary”
We would like to let you know that you can customize the caption summary , where caption summary is used to display the summary information in the caption of the group. The data grid supports to display the concise information about the bound data objects using summaries. Also we would like to let you know that if you return the column name as string with numbers it will be display the same, datagrid allows you to customize the captionsummary by GridSummaryRow.
#Regarding to remove column name from caption summary
We suggest you to set the GroupCaptionTextFormat to specify the text in the caption summary . we have attached the modified sample, code snippet and documentation for your reference.
Code snippet:
|
<sfgrid:SfDataGrid x:Name="sfGrid" AutoExpandGroups="False" AllowGroupExpandCollapse="True" AllowResizingColumn="True" AllowSorting="True" BackgroundColor="Transparent" ColumnSizer="Auto" ScrollingMode="Line" GroupCaptionTextFormat="{}{Key}" AutoGenerateColumns="True" ItemsSource="{Binding OrdersInfo}"> <sfgrid:SfDataGrid.GroupColumnDescriptions> <sfgrid:GroupColumnDescription ColumnName="OrderID" /> <sfgrid:GroupColumnDescription ColumnName="CustomerID"/> </sfgrid:SfDataGrid.GroupColumnDescriptions> </sfgrid:SfDataGrid> |
UG Link: https://help.syncfusion.com/xamarin/datagrid/summary#displaying-summary-for-a-row
Please let us know if you need further assistance.
Regards,
Suthi Yuvaraj
Hi Peter,
Sorry for inconvenience caused . please find the sample in this update.
Regards
Suthi Yuvaraj.