I am looking for the same functionality.
I looked at the 2 links you provided.
The problem is that I don't know what columns are in the grid. That is up to the user, he can add his own queries.
I just want a record counter that counts the number of records in the grid without knowing what data is in the grid.
Do you have an example for this scenario?
Hi Johan Visser,
We have analyzed your query. Your requirement to display the number of records in the DataGrid without knowing the data , can be achieved by accessing the Records Count property of the DataGrid. We have implemented a solution to show the record count in the TableSummaryRows template, using a TextBlock and binding a converter to display the records count.
Kindly
refer to the code snippet below,
and let
us know if you have any further concerns regarding this.
Code Snippet:
<local:TableSummaryRowConverter x:Key="summaryConverter"/> </Window.Resources> <syncfusion:SfDataGrid.TableSummaryRows> <syncfusion:GridTableSummaryRow Title="Total Record" ShowSummaryInRow="True"> <syncfusion:GridSummaryRow.TitleTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource summaryConverter}, ConverterParameter= {x:Reference Name= dataGrid}}"></TextBlock> </DataTemplate> </syncfusion:GridSummaryRow.TitleTemplate> </syncfusion:GridTableSummaryRow> </syncfusion:SfDataGrid.TableSummaryRows> </syncfusion:SfDataGrid>
/// Converter Code
public class TableSummaryRowConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
var count = (parameter as SfDataGrid).View.Records.Count; return "Total Records : " + count.ToString(); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; } }
|