A way to get 'underlying' rows

5 posts, 1 answers
  1. Ilya
    Ilya avatar
    7 posts
    Member since:
    Dec 2012

    Posted 21 Jul 2013 Link to this post

    Greetings!

    I would like to know, how can I get all the rows that 'lie' beneath a visible cell value. So, for example, i have a cell value which is composed from two (or more) rows in pivots`s datasource. I want to get those rows somehow. Is it possible?

    Thanks!
  2. Ilya
    Ilya avatar
    7 posts
    Member since:
    Dec 2012

    Posted 22 Jul 2013 Link to this post

    I`ve found an example of how Devexpress team made it. Look here: http://documentation.devexpress.com/#WindowsForms/CustomDocument1884

    Is it possible in Telerik?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Paul
    Admin
    Paul avatar
    60 posts

    Posted 25 Jul 2013 Link to this post

    Hello Ilya,

    Thank you for writing.

    Currently Telerik PivotGrid does not support such functionality, but we will consider implementing it in a future release.

    Please let us know if we can assist you with anything else.

    Regards,
    Paul
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  5. Barry
    Barry avatar
    18 posts
    Member since:
    Jul 2008

    Posted 01 Aug 2013 Link to this post

    Yes, you can get the underlying rows!

    But it would be nice if Telerik provided a more straight forward method!

    The code below uses the pivot controls mouse click event to select all the contributing rows to an aggregate value in a girdview bound to the same datasource as the pivot table. The code only handles a simple column aggregate, but handles more complex row scenarios. It should be straight forward to translate the row logic into column logic. I have tested that it works for a few scenarios - but the code has not been tested exhaustively, anybody using this code should check it meets their needs. If anybody has an improved version (or a better method), please post it back on this forum.

    In the code:
                  rPivot is a radPivotGrid control,
     frmSiteVisits.rgvSiteVisits refers to a GridView on a different form bound to the same data source as rPivot.

    private void rPivot_MouseClick(object sender, MouseEventArgs e)
            {
                PivotCellElement currentCell = rPivot.PivotGridElement.ElementTree.GetElementAtPoint(e.Location) as PivotCellElement;
                
                if (currentCell != null)
                {
                    string column = currentCell.Column.Name;
                    string rowName = currentCell.Row.Name;
     
                    PivotGroupNode currentRow = currentCell.Row;
                    string columnPropertyName = rPivot.ColumnGroupDescriptions[0].GetUniqueName();
                    int level = currentCell.Row.Group.Level;
                    if (rPivot.AggregateDescriptions.Count > 1)
                    {
                        level = level - 1;
                        if (level < 0)
                        {
                            level = 0;
                            rowName = currentCell.Row.Name;
                            currentRow = currentCell.Row;
                        }
                        else
                        {
                            rowName = currentCell.Row.Parent.Name;
                            currentRow = currentCell.Row.Parent;
                        }
                    }
                    string rowPropertyName = rPivot.RowGroupDescriptions[level].GetUniqueName();
                     
                    if (currentCell.IsInSubTotalRow)
                    {
                        rowName = currentCell.Row.Parent.Name;
                        rowPropertyName = rPivot.RowGroupDescriptions[level-1].GetUniqueName();
                    }
     
                    frmSiteVisits.rgvSiteVisits.FilterDescriptors.Clear();
                    if (!currentCell.IsInGrandTotalColumn)
                    {
                        frmSiteVisits.rgvSiteVisits.FilterDescriptors.Add(columnPropertyName, Telerik.WinControls.Data.FilterOperator.IsEqualTo, column);
                    }
                    if (!currentCell.IsInGrandTotalRow)
                    {
                        frmSiteVisits.rgvSiteVisits.FilterDescriptors.Add(rowPropertyName, Telerik.WinControls.Data.FilterOperator.IsEqualTo, rowName);
                        while (level > 0)
                        {
                            level -= 1;
                            currentRow = currentRow.Parent;
                            rowName = currentRow.Name;
                            rowPropertyName = rPivot.RowGroupDescriptions[level].GetUniqueName();
                            frmSiteVisits.rgvSiteVisits.FilterDescriptors.Add(rowPropertyName, Telerik.WinControls.Data.FilterOperator.IsEqualTo, rowName);
                        }
                         
                    }       
                }
            }

    Barry
  6. Paul
    Admin
    Paul avatar
    60 posts

    Posted 06 Aug 2013 Link to this post

    Hello Barry,

    Thank you for the effort and supplied code.

    The idea of using the grid view for holding the data is really good.
    I believe that the community will benefit from your ideas.
    I have added some Telerik points to your account for your contribution.

    Regards,
    Paul
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready