Expand/collapse button in RadGridView column group

5 posts, 1 answers
  1. sajin
    sajin avatar
    3 posts
    Member since:
    Dec 2018

    Posted 04 Dec 2018 Link to this post

    Successful to get the button into header cell for expanding/collapsing the group columns except last one (this is sum of the reaming  columns since should not be collapsed) in each group.

    This has been achieved by creating button in header cell through  radgrid CreateCell event.

    But failed to achieve couple of below things,
    Refer attached screenshot, expand/collapse button must be placed in title of the group, marked 1 in attached image. New position should be marked  in second image.
    Button image must be changed, meaning while expanding, there is should be one image ,when collapsing there should be another image.
    (Have tried this, but it is behaving strange, button image is getting changed in different position, seems it is redrawing )

    Appreciate, if somebody could help us to accomplish this
  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 05 Dec 2018 Link to this post

    Hello, Sajin,    

    The following help article demonstrates a sample approach how t create custom cells in RadGridView: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells
    Note that due to the UI virtualization in RadGridView, cell elements are created only for currently visible cells and are being reused during operations like scrolling, filtering, grouping and so on.  You can define that the custom cell is applicable only for specific columns by overriding the IsCompatible method of the cell element that you want to customize. This will prevent the cell from being unintentionally reused by other columns. The cell's SetContentCore method is suitable for synchronizing the data that is currently being displayed in the cell. This is the appropriate place for the image to be set considering the expanded state.

    In order to inspect easily which element exactly you need to customize and insert the button, feel free to use RadControlSpyForm. For example, GridColumnGroupCellElement is used in the marked "1" number in the screenshot.

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. sajin
    sajin avatar
    3 posts
    Member since:
    Dec 2018

    Posted 05 Dec 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Team,

    Thank you for coming back promptly.

    have tried as you suggested, but no luck. Post changing GridHeaderCellElement to GridColumnGroupCellElement ,button has disappeared and also unable to achieve change of button image as well.  Sample application can be downloaded from the blow link .could you please Suggest on it?

     

    https://drive.google.com/file/d/1EzKb6QPDj7ndWk4oL4E6CQpTWy2hXOfv/view?usp=sharing

  4. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 10 Dec 2018 Link to this post

    Hello, Sajin,    

    I have reviewed the provided sample project and made thе following changes:

    1. Subscribe to the CreateCell event before calling the DefineGroups method.
    2. The custom ExpandCollapseHeaderCellElement inherits from GridColumnGroupCellElement
    3. In the CreateChildElements method, add directly the RadButtonElement to the Children collection of the cell.
    4. In the CreateCell event replace the default GridColumnGroupCellElement with the custom one.

    Please refer to the attached modified sample project.



    Off topic, I would kindly ask you to submit a support ticket from your Telerik account if you have any further questions. Thus, you will be allowed to attach sample projects. Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

    I hope this information helps.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. sajin
    sajin avatar
    3 posts
    Member since:
    Dec 2018

    Posted 11 Dec 2018 Link to this post

    Sure, Thank you team. Will raise support ticket from our Telerik account
Back to Top