How to expand one level on each click when all row fields are collapsed initially

16 posts, 0 answers
  1. Richard
    Richard avatar
    1 posts
    Member since:
    Feb 2013

    Posted 20 Mar 2013 Link to this post

    I have 4 row fields defined in RadPivotGrid. I made all row fields colapsed initially by set RowGroupsDEfaultExpanded attribute to false. But once I click the expand button on top level, it expands all 4 level for me, but I expect just expand level 2. Is there any way to change it? Thanks.
  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 25 Mar 2013 Link to this post

    Hi Richard,

    Thank you for contacting us.

    In order to achieve the desired goal you will have to use the CollapseAllRowGroups server-side method of the RadPivotGrid. You can use the code from the code snippet below to prevent the expanding of the 2nd and 3rd level of the hierarchy:
    protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            RadPivotGrid2.CollapseAllRowGroups(1,false);
        }

    More information about this method and how it works you can find here.

    Let me know if I could assist you further.

    Kind regards,
    Angel Petrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tanvir
    Tanvir avatar
    3 posts
    Member since:
    Apr 2013

    Posted 01 Jan 2014 Link to this post

    I am having two issues with telerik Pivot Grid. 

    1) Throws error when i try to collapse or expand the row(s). Is there an event i can handle on server side ?
    2) On load for the first time Grid do not size the columns correctly. when i refresh it works okay.

    Thank you.
    Tanvir Shaikh
  5. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 06 Jan 2014 Link to this post

    Hi Tanvir,

    The behavior experienced is not expected. However it is difficult to provide a precise answer on why does it occur without having a better view over the setup. That said could you please share with us the markup and code-behind of the pivot page so we could investigate further.

    As for intercepting the expand/collapse I suggest subscribing to the OnItemCommand event like demonstrated below:

    C#:
    protected void RadPivotGrid1_ItemCommand(object sender, PivotGridCommandEventArgs e)
        {
            if(e.CommandName=="ExpandCollapse")
            {
            }
        }


    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. Tanvir
    Tanvir avatar
    3 posts
    Member since:
    Apr 2013

    Posted 06 Jan 2014 Link to this post

    I was able to resolved the issue by refreshing the data. It seems like some how the rows were getting lost.
    I did check the view state and it is enabled.

    If you have a better solution do send it to me.
    Thank you for your help.

    C#:
    protected void RadPivotGrid1_ItemCommand(object sender, PivotGridCommandEventArgs e)
        {
            if(e.CommandName=="ExpandCollapse")
            {
                  LoadRadPivotGrid();
            }
        }
  7. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 09 Jan 2014 Link to this post

    Hello Tanvir,

    I am glad that you were able to resolve the problem on hand. However note that you should not had experienced such behavior. If you can provide us with the markup and code-behind of the page we will investigate further what might be causing it.

    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  8. Prabhu
    Prabhu avatar
    8 posts
    Member since:
    Apr 2014

    Posted 02 Apr 2014 Link to this post

    Hi ,
    In RadPivotGrid control  expand and collapse for column its expand all fields.. for example you've 3 sub field  one by one. its expand and collapse  all column but i need  expand all column  don't collapse  last two fields ...

    that means how to hide collapse single column(row) in RadPivotGrid.. Reply ASAP
  9. Prabhu
    Prabhu avatar
    8 posts
    Member since:
    Apr 2014

    Posted 04 Apr 2014 Link to this post

    Please can you tell me how to hide collapse and expand image in radpivotgrid  in second field
  10. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 07 Apr 2014 Link to this post

    Hello Prabhu,

    For hiding the column header expand button you can subscribe to the OnCellDataBound and execute the following logic.

    C#:
    protected void RadPivotGrid1_CellDataBound(object sender, PivotGridCellDataBoundEventArgs e)
        {
            
            PivotGridColumnHeaderCell columnHeader = e.Cell as PivotGridColumnHeaderCell;
            if (columnHeader != null)
            {
                if (columnHeader.Controls.Count > 0 && columnHeader.ParentIndexes.Count() > 1)
                {
                    (columnHeader.Controls[0] as Button).Visible = false;
                }
            }
        }

    If needed the same can also be applied for the row header cells as demonstrated below.

    C#:
    protected void RadPivotGrid1_CellDataBound(object sender, PivotGridCellDataBoundEventArgs e)
        {
            PivotGridRowHeaderCell rowHeader = e.Cell as PivotGridRowHeaderCell;
            if (rowHeader != null)
            {
                if (rowHeader.Controls.Count > 0 && rowHeader.ParentIndexes.Count() > 1)
                {
                    (rowHeader.Controls[0] as Button).Visible = false;
                }
            }
        }


    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  11. Prabhu
    Prabhu avatar
    8 posts
    Member since:
    Apr 2014

    Posted 09 Apr 2014 in reply to Angel Petrov Link to this post

    Hello,
     I've more than three sub header in pivodgrid  when i click 1st headercell its show next header with collapse button then others.. like to end...

    but i need , when i'm  expand 1st click in header its show all sub header  upto datafield without expand/collapse button.. is it possible...
    please tell me soon
  12. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 14 Apr 2014 Link to this post

    Hi Prabhu,

    Actually by integrating the approach which I provided in my previous post you should be able to hide the expand/collapse buttons as you can see from this video. Am I not understanding the requirement correctly?

    If you want to hide the expand collapse buttons for the parent headers as well you should modify the logic like demonstrated below:

    C#:
    void pivotGrid_CellDataBound(object sender, PivotGridCellDataBoundEventArgs e)
       {
           PivotGridColumnHeaderCell columnHeader = e.Cell as PivotGridColumnHeaderCell;
           if (columnHeader != null)
           {
               if (columnHeader.Controls.Count > 0)
               {
                   (columnHeader.Controls[0] as Button).Visible = false;
               }
           }
           PivotGridRowHeaderCell rowHeader = e.Cell as PivotGridRowHeaderCell;
           if (rowHeader != null)
           {
               if (rowHeader.Controls.Count > 0)
               {
                   (rowHeader.Controls[0] as Button).Visible = false;
               }
           }
       }


    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  13. Prabhu
    Prabhu avatar
    8 posts
    Member since:
    Apr 2014

    Posted 15 Apr 2014 in reply to Angel Petrov Link to this post

    Thanks a lot Angel...

    1.could you tell me how to default only one column expand when page load... ?
    2. how to use label to that given expanded row in  the right side of the pivotgrid..?

    ref:Attached image
  14. Prabhu
    Prabhu avatar
    8 posts
    Member since:
    Apr 2014

    Posted 16 Apr 2014 Link to this post

    Hi Friends..
    I've two  question .Could you tell me  any one please

    1. how to default only one column expand when page load... ?
    2. how to use label to that given expanded row in  the Left side of the pivotgrid..?

    ref:Attached image
  15. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 18 Apr 2014 Link to this post

    Hello Prabhu,

    In order to expand only one column you can set ColumnGroupsDefaultExpanded to true and add the column fields in the CollapsedColumnIndexes collection. For example:
    protected override void OnPreRender(EventArgs e)
        {
            
            base.OnPreRender(e);
            RadPivotGrid1.ColumnGroupsDefaultExpanded = true;
            RadPivotGrid1.CollapsedColumnIndexes.Add(new string[] { "2015","2016" });
            RadPivotGrid1.Rebind();
        }
    should collapse 2015 and 2016 if present.

    As for adding labels in the row headers zone I would not recommend it as this might break the layout and functionality of the control. That said I would suggest revising the requirement.

    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  16. Prabhu
    Prabhu avatar
    8 posts
    Member since:
    Apr 2014

    Posted 21 Apr 2014 Link to this post

    Hi friends...
    Is it possible to create Editable pivot grid with expand & collapse in telerik ?
    if its there please send me sample code  to my mail.
  17. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 24 Apr 2014 Link to this post

    Hello Prabhu,

    I am sorry to say but such functionality is currently not supported and I am not sure that it will be included in a future release. The problem is that the pivot displays aggregated values and it is hard to determine which values in the database should get updated once the user tries to submit the changes. If however you have something specific in mind I would recommend logging it into our feedback portal.

    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017