BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
I am working with windows form pivot grid control, while I drag and drop columns it’s automatically create group and viewed in expand mode. Now I want to collapse and expand the created groups programmatically . Please send sample coding.
Regards
T.Ashokraj
Hi Ashokraj,
Thank you for your interest in Syncfusion products.
We
would like to let you know that the grouped columns can be expanded by ExpandAllColumnGroups() and collapsed by CollapseAllColumnGroups() methods in the TableControl property. If you want to collapse and expand the all
the groups, you can use ExpandAllGroups()
and CollapseAllGroups() methods.
Please
refer the below code:
this.pivotGridControl1.TableControl.CollapseAllColumnGroups();
this.pivotGridControl1.TableControl.ExpandAllColumnGroups();
this.pivotGridControl1.TableControl.CollapseAllGroups();
this.pivotGridControl1.TableControl.ExpandAllGroups();
Please let me know if you have any concerns.
Regards,
Neelakandan
Hi Ashokraj,
Thank you for your interest in Syncfusion products.
If you want to collapse the particular row or particular hierarchy of the PivotGrid, you can use the CollapseRow method .In this method you have to pass the UniqueText name(i.e)RowFieldName. You can make use of below code,
private void button1_Click(object sender, EventArgs e)
{
if (this.pivotGridControl1.PivotEngine != null)
{
int row, column;
PivotCellInfo cellInfo = null;
GridStyleInfo styleInfo = null;
for (row = this.pivotGridControl1.PivotEngine.PivotColumns.Count + (!this.pivotGridControl1.PivotEngine.ShowCalculationsAsColumns ? 1 : 0); row < this.pivotGridControl1.PivotEngine.RowCount; row++)
{
for (column = 0; column < this.pivotGridControl1.PivotEngine.PivotRows.Count - 1; column++)
{
cellInfo = this.pivotGridControl1.PivotEngine[row, column];
styleInfo = this.pivotGridControl1.TableModel[row + 1, column + 1];
if (cellInfo != null && cellInfo.CellType == (PivotCellType.RowHeaderCell | PivotCellType.ExpanderCell)
&& styleInfo.CellType == "PivotGridExpandCell" && cellInfo.UniqueText.IndexOf('.') == -1 && cellInfo.UniqueText != "x")
{
this.pivotGridControl1.TableControl.CollapseRow(cellInfo.UniqueText);
}
}
}
}
}
Note:
By using above code you can collapse all the RowField in first hierarchy. If you want to collapse particular RowField, you can directly pass the UniqueText in the CollapseRow method.
Please refer the below sample:
http://www.syncfusion.com/downloads/support/directtrac/general/Pivot_Grid_Demo-1980595831.zip
Please let me know if you have any concern.
Regards,
Neelakandan
Hi Ashokraj,
Thank you for your update.
We could not reproduce your query at our end. Please provide us a simple sample to reproduce your query. It will help us to provide better solution as soon as possible.
Please let me know if you have any concern.
Regards,
Neelakandan
Hi Ashokraj,
Regret for the inconvenience caused.
We would like to let you know that we could able to Collapse RowGroup at our end. Please recheck with below sample.
Please refer the below video:
http://www.syncfusion.com/downloads/support/directtrac/72755/SampleVideoPivot-1609972437.zip
Please refer the below sample:
http://www.syncfusion.com/downloads/support/directtrac/72755/Pivot_Grid_Demo-1943046310.zip
Please let me know if I misunderstood your query.
Regards,
Neelakandan
Hi Ashokraj,
Regret for the inconvenience caused.
We could not able to reproduce your query at our end. Please provide us details about product version and preferable programming language (VB or C#)you are using. It will help us to provide better solution as soon as possible.
Please let me know if you have any concern.
Regards,
Neelakandan