Table summary template

Good morning, excuse me, I am trying to make a template of the summary of the table, but it appears blank, it is not possible to visualize the added text.
It would have to leave "Total Raised:" + amount
How can I link that? i am working without mvvm



8 Replies

MK Muthu Kumaran Gnanavinayagam Syncfusion Team March 5, 2020 07:18 AM UTC

Hi David, 
 
Thank you for using Syncfusion products. 
 
We have analyzed the reported query “Need to use template for TableSummary of SfDataGrid” from our side. We would like to let you know that you can achieve your requirement through IValueConverter. We have already mentioned regarding this in our UG documentation and you can refer the same for further details.  
 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu kumaran. 



DA David March 6, 2020 05:05 PM UTC

When I want to implement the ContentPage.Resources command I get the following observation.





MK Muthu Kumaran Gnanavinayagam Syncfusion Team March 9, 2020 05:36 AM UTC

Hi David, 
 
We have analyzed the attached code snippets at our end and found that you have added the ResourceDictionary inside the ContentPage.Content which caused the reported error. So need to add ResourceDictionary outside the ContentPage.Content as like below. 
 
Code Example: 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:local="clr-namespace:DataGridDemo" 
             xmlns:sfgrid="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms" 
             xmlns:sfPager="clr-namespace:Syncfusion.SfDataGrid.XForms.DataPager;assembly=Syncfusion.SfDataGrid.XForms" 
             x:Class="DataGridDemo.MainPage"> 
 
  <ContentPage.Resources> 
    <ResourceDictionary> 
      <local:TableSummaryConverter x:Key="SummaryConverter" /> 
    </ResourceDictionary> 
  </ContentPage.Resources> 
 
  <ContentPage.Content> 
    <StackLayout> 
      <sfgrid:SfDataGrid x:Name="dataGrid" 
                         ItemsSource="{Binding OrdersInfo}" 
                         AutoGenerateColumns="False" 
                         AllowEditing="True" 
                         NavigationMode="Cell" 
                         SelectionMode="Single" 
                         ColumnSizer="Star"> 
        <sfgrid:SfDataGrid.Columns> 
          <sfgrid:GridNumericColumn MappingName="OrderID" /> 
          <sfgrid:GridTextColumn MappingName="EmployeeID" /> 
          <sfgrid:GridTextColumn MappingName="FirstName"  /> 
          <sfgrid:GridTextColumn MappingName="LastName"  /> 
        </sfgrid:SfDataGrid.Columns> 
        <sfgrid:SfDataGrid.TableSummaryTemplate> 
          <DataTemplate> 
            <ViewCell> 
              <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> 
                <Label Text="{Binding Converter={StaticResource SummaryConverter}, ConverterParameter = {x:Reference dataGrid} }" 
                       TextColor="White" 
                       FontSize="Large" 
                       VerticalTextAlignment="Center" 
                       HorizontalTextAlignment="Start" 
                       LineBreakMode="NoWrap" 
                       HorizontalOptions="FillAndExpand" 
                       VerticalOptions="FillAndExpand"> 
                  <Label.Style> 
                    <Style TargetType="Label"> 
                      <Setter Property="FontAttributes" Value="Italic" /> 
                    </Style> 
                  </Label.Style> 
                </Label> 
              </StackLayout> 
            </ViewCell> 
          </DataTemplate> 
        </sfgrid:SfDataGrid.TableSummaryTemplate> 
        <sfgrid:SfDataGrid.TableSummaryRows> 
          <sfgrid:GridTableSummaryRow Title="Total Salary :{TotalSalary} for {ProductCount} members" 
                                      Position="Bottom" 
                                      ShowSummaryInRow="True"> 
            <sfgrid:GridTableSummaryRow.SummaryColumns> 
              <sfgrid:GridSummaryColumn Name="TotalSalary" 
                                        Format="{}{Sum:c}" 
                                        MappingName="OrderID" 
                                        SummaryType="DoubleAggregate" /> 
            </sfgrid:GridTableSummaryRow.SummaryColumns> 
          </sfgrid:GridTableSummaryRow> 
        </sfgrid:SfDataGrid.TableSummaryRows> 
      </sfgrid:SfDataGrid> 
    </StackLayout> 
  </ContentPage.Content> 
</ContentPage> 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu kumaran. 



DA David July 21, 2020 03:38 PM UTC

If I am not using an MVVM, I can use the Binding Converter. Since I am loading my grid with a database query, through Item Source and not using data binding


KK Karthikraja Kalaimani Syncfusion Team July 22, 2020 11:55 AM UTC

Hi David,

If I have understood your query correctly, your using a project without MVVM. You’re not binding a data source as items source, but rather your setting a collection that is queried from the data base. Firstly please conform me whether my understanding of your scenario is correct.

Secondly, irrespective of whether or not the items source is set to datagrid via binding, the converter written for the label that is loaded as template of for table summary should be fired. The converter will be fired whenever the row comes to view. Is the converter not firing for you? Or you’re not able to implement the converter for any reason? Please let us know these details so that we can look into it further.

As always if you could provide a replication sample it would be more helpful and will enable us to resolve your query quicker than you expect. 
  
We will wait to hear from you and are ready to offer any assistance that is required related to this. 


Regards,
Karthik Raja 



DA David July 22, 2020 01:33 PM UTC

Exactly, I'm not using MVVM, and I'm getting the information from a database and saving it to a List, which I then relate to the datagrid with the itemsource property.

Regarding the second point, if it is firing, but the value is always 0, even if there is information. 

Images


















KK Karthikraja Kalaimani Syncfusion Team July 23, 2020 02:27 PM UTC

Hi David,

Currently, we are working on your requirement. We will update further details on or before 27th July 2020. We appreciate your patience until then.

Regards,
Karthik Raja



KK Karthikraja Kalaimani Syncfusion Team July 27, 2020 12:53 PM UTC

 
Hi David,

We have checked the reported issue “Table summary values always shows 0” and we used BindingConverter to calculate the TableSummary in the simple sample. Unfortunately, we could not able to reproduce the reported issue in our end and it is working fine as expected. We have attached the tested sample for your reference. Please share the below details to check the issue further and provide you a better solution earlier.

i) SfDataGrid complete code snippet
ii) SfDataGrid and Xamarin Forms version

 
Note : We checked the behavior in SfDataGrid v18.2.0.46 and Xamarin Forms v3.6.0.344457

Sample link :  https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridSample1373350445-101669139.zip

Regards,
Karthik Raja 


Loader.
Up arrow icon