We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Collapse the Group created in pivot grid control

Hi

        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

 

    


9 Replies

NK Neelakandan Kannan Syncfusion Team June 24, 2014 06:48 AM UTC

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



AS Ashokraj June 26, 2014 10:31 AM UTC

Hi Neelakandan
   Thanks for your reply.
  I tried this coding but it not works . i want to collapse the rows of pivot row items in the grid.
Herewith i attached file which is having the details which i want to collapse.
please give any other ideas to collapse all items
Thanks in advance
Regards
T.Ashokraj

Attachment: collapse_6ab61362.zip


NK Neelakandan Kannan Syncfusion Team June 27, 2014 10:35 AM UTC

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



AS Ashokraj June 30, 2014 12:33 PM UTC

Hi Kannan
   I tried your coding its not works.
your sample also didn't work please check
Regards
T.Ashokraj
 


NK Neelakandan Kannan Syncfusion Team July 1, 2014 05:39 AM UTC

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



AS Ashokraj July 1, 2014 07:47 AM UTC

Hi Kannan
   Thanks for your reply.
    You just try with your sample which attached by you on 26, 2014 06:31 AM
in that sample itself collapse group didnt happen while pressing that button.
Regards
T.Ashokraj


NK Neelakandan Kannan Syncfusion Team July 2, 2014 08:36 AM UTC

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



AS Ashokraj July 3, 2014 04:51 AM UTC

  HI Kannan
    Ya your video shows my correct requirement.
 I tried you sample following 4 errors are coming
    Error 1 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControlBase' does not contain a definition for 'CollapseAllGroups' and        noextension method 'CollapseAllGroups' accepting a first argument of type 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControlBase' could be found (are you missing a using directive or an assembly reference?) C:\Users\ashokraj.t\Desktop\Pivot Grid Demo\Form1.cs 171 49 PivotGridDemo_2010

Error 2 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControlBase' does not contain a definition for 'ExpandAllRowGroups' and no extension method 'ExpandAllRowGroups' accepting a first argument of type 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControlBase' could be found (are you missing a using directive or an assembly reference?) C:\Users\ashokraj.t\Desktop\Pivot Grid Demo\Form1.cs 212 49 PivotGridDemo_2010
Error 3 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControl' does not contain a definition for 'EditManager' and no extension method 'EditManager' accepting a first argument of type 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControl' could be found (are you missing a using directive or an assembly reference?) C:\Users\ashokraj.t\Desktop\Pivot Grid Demo\Form1.Designer.cs 52 35 PivotGridDemo_2010
Error 4 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControl' does not contain a definition for 'UpdateManager' and no extension method 'UpdateManager' accepting a first argument of type 'Syncfusion.Windows.Forms.PivotAnalysis.PivotGridControl' could be found (are you missing a using directive or an assembly reference?) C:\Users\ashokraj.t\Desktop\Pivot Grid Demo\Form1.Designer.cs 62 35 PivotGridDemo_2010
  
Regards
T.Ashokraj
        


NK Neelakandan Kannan Syncfusion Team July 3, 2014 12:23 PM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon