Hi everybody,
we are thinking of replacing a gridcontrol we use in older applications with a syncfusion control as we want to move to dotnet 6.
To display filtered / grouped or all rows rows, there are properties called FilteredInRowCount and FilteredInNonGroupByRowCount (see attached video)
string cText = this.cGridTitle + " -> " + this.uGrid_Auswahl.Rows.FilteredInRowCount.ToString() + " Rows " + " of " + this.uGrid_Auswahl.Rows.FilteredInNonGroupByRowCount.ToString() ;
Is there anything similar in sfDataGrid. I tried a sample based on sfGrid_DrawCell, but I failed because draw_cell was called more than once per row.
private void SfGrid_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e) { if (e.DataRow.RowType == RowType.CaptionCoveredRow && !string.IsNullOrEmpty(e.DisplayText)) { System.Diagnostics.Debug.WriteLine("SfGrid_DrawCell ++++++++++++++++++++++++++++++++++++"); var group = (e.DataRow.RowData as Syncfusion.Data.Group); if (group.Groups is null) { GroupCount++; this.lbl_Caption.Text = GroupCount.ToString() + " von " + cAllRows; } }
Thank you
regards
Uwe
|
//To get the filtered rowcount.
this.sfDataGrid1.View.Records.Count();
//To get the group count after the column is grouped.
this.sfDataGrid1.View.TopLevelGroup.Count()
|
Hi Sampath Narayanan.S,
thank you for your answer. Could you please tell me what event to check after a column has been dropped onto the drop area to create a group in order to update my grid header. I tried ColumnDescriptions_CollectionChanged, but sfDataGrid1.View.TopLevelGroup is null when this event is called.
Thank you
regards
Uwe
|
this.sfDataGrid1.GroupColumnDescriptions.CollectionChanged += GroupColumnDescriptions_CollectionChanged;
private void GroupColumnDescriptions_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
MessageBox.Show(this.sfDataGrid1.View.TopLevelGroup.Count().ToString());
} |
Hi Sampath Narayanan.S,
thank you for your sample. There must be an error in TopLevelGroupCount. If you group on Role ID you get 7 for TopLevelGroupCount though there are only 2 different RowIds.
So it should be 2 instead of 7!
regards
Uwe
|
this.sfDataGrid1.View.TopLevelGroup.Groups.Count()
|
Hi,
did you check your own sample ?
this.sfDataGrid1.View.TopLevelGroup.Groups.Count() returns the WRONG count. It must be 2 instead of 7. Please check your own sample !
HI Uwe,
As we updated previously, if you need row count after Grouping you can get using `SfDataGrid.View.TopLevelGroup.Count()` and if you need the count of groupedrows, you can get using `SfDataGrid1.View.TopLevelGroup.Groups.Count()`.
Sample Link : https://www.syncfusion.com/downloads/support/forum/173387/ze/SfDataGridDemo333359215
Video Link : https://www.syncfusion.com/downloads/support/forum/173387/ze/Video-837015914
Please refer the sample and video from the link and let us know if you have any concerns.
Regards,
Sampath Narayanan.S
Hi Sampath Narayanan.S,
I must apologize - your answer was correct. I did not read carefully. Sorry...
regards
Uwe
Hi Uwe,
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you.
Regards,
Sampath Narayanan.S