Records count

It is simple way to display number of records in GGC.
TopLevelGroupOption.CaptionText = "{RecordCount}"
User would like to see this information on bottom of the grid.

It is possible to put this section to bottom ?
Or other simple way to put number of records under the list.

3 Replies

PM Piruthiviraj Malaimelraj Syncfusion Team December 11, 2017 07:15 AM UTC

Hi Krzysztof, 
 
Thanks for contacting Syncfusion support. 
 
By default, the GridGroupingControl does not have the support to show the caption at the end of the grid. If you want to show the caption the bottom of grid, enable the footer for grid and set the footer text as caption text. You can update the caption text in Footer while modifying the data source by using SourceListListChanged event. Please make use of the below code snippet, 
 
Code snippet: 
this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false; 
//Display the GroupFooter cell 
this.gridGroupingControl1.TopLevelGroupOptions.ShowGroupFooter = true; 
 
//Set the caption text to be displayed 
CaptionText = this.gridGroupingControl1.TableDescriptor.Name + ":" + this.gridGroupingControl1.Table.Records.Count + " Items"; 
 
this.gridGroupingControl1.Appearance.GroupFooterSectionCell.CellValue = CaptionText; 
 
//Disable the editing 
this.gridGroupingControl1.Appearance.GroupFooterSectionCell.CellType = GridCellTypeName.Static; 
 
//Set the height of the GroupCaption 
this.gridGroupingControl1.TableOptions.GroupFooterSectionHeight = 20; 
 
this.gridGroupingControl1.SourceListListChanged += GridGroupingControl1_SourceListListChanged; 
 
private void GridGroupingControl1_SourceListListChanged(object sender, Syncfusion.Grouping.TableListChangedEventArgs e) 
{ 
    //To update the caption text in Footer. 
    if(e.ListChangedType == ListChangedType.ItemAdded || e.ListChangedType == ListChangedType.ItemDeleted) 
    { 
        CaptionText = this.gridGroupingControl1.TableDescriptor.Name + ":" + this.gridGroupingControl1.Table.Records.Count + " Items"; 
        this.gridGroupingControl1.Appearance.GroupFooterSectionCell.CellValue = CaptionText; 
    } 
} 
 
Sample link: 
 
Note: 
The footer row cannot be frozen. So you need to scroll down to view the caption text. 
 
Regards, 
Piruthiviraj


KA Krzysztof Adamowicz December 17, 2017 11:16 PM UTC

Footer not solve the case, because I wat to see count always.
I puted panel with label below Grid and put count after changing.


AR Arulpriya Ramalingam Syncfusion Team December 18, 2017 12:47 PM UTC

Hi Krzysztof, 
 
Thanks for your update. 
 
You can add a label inside a panel to appear as CaptionRow. And also, this can be achieved by placing a GridControl at the bottom of the GridGroupingControl with a single row which appears to be a CaptionRow for the control. Moreover, the SourceListListChangedCompleted event can be used to update the records count when the records are added or removed. Please make use of below code and sample, 
 
Code example 
 
//Set the caption text to be displayed 
captionText = this.gridGroupingControl1.TableDescriptor.Name + ":" + this.gridGroupingControl1.Table.Records.Count + " Items"; 
 
#region Grid customization 
captionGrid = new GridControl(); 
captionGrid.Dock = DockStyle.Bottom; 
captionGrid.Height = 35; 
captionGrid.RowCount = 1; 
captionGrid.ColCount = 1; 
captionGrid.ShowRowHeaders = false; 
captionGrid.ShowColumnHeaders = false; 
captionGrid.HScroll = false; 
captionGrid.VScroll = false; 
//Set the height of the CaptionRow 
captionGrid.DefaultRowHeight = 30; 
captionGrid.DefaultColWidth = this.gridGroupingControl1.TableControl.Width - 18; 
//Disable the editing 
captionGrid[1, 1].CellType = GridCellTypeName.Static; 
captionGrid[1, 1].CellValue = captionText; 
#endregion 
 
//To add the Caption row at the bottom of the grid 
this.gridGroupingControl1.GridTablePanel.Controls.Add(captionGrid); 
//Event Triggering 
this.gridGroupingControl1.SourceListListChangedCompleted += GridGroupingControl1_SourceListListChangedCompleted; 
 
//Event customization 
private void GridGroupingControl1_SourceListListChangedCompleted(object sender, Syncfusion.Grouping.TableListChangedEventArgs e) 
{ 
    //To update the caption text in bottom. 
    if (e.ListChangedType == ListChangedType.ItemAdded || e.ListChangedType == ListChangedType.ItemDeleted) 
    { 
        captionText = this.gridGroupingControl1.TableDescriptor.Name + ":" + this.gridGroupingControl1.Table.Records.Count + " Items"; 
        captionGrid[1, 1].CellValue = captionText; 
    } 
} 
 
 
Please let us know if you have any other queries. 
 
Regards, 
Arulpriya 


Loader.
Up arrow icon