GridView Column Picker?

1 Answer 41 Views
GridView
Bradley
Top achievements
Rank 2
Iron
Iron
Iron
Bradley asked on 22 Nov 2024, 12:31 AM

    I'm trying to allow for user customization of a grid with as little effort as possible.  In order of priority,

    1. I would like my user to be able to choose which columns are displayed in the grid, and in which order.  I'd really like a pre-built control for this, if one exists.  My vision is a list of all available columns on the left, and, on the right, a re-orderable list of columns being used.
    2. I'd like to do the same with groupings (already easy, but leading up to saving).
    3. The user should be able to set column widths and sort direction (already easy, but leading up to saving).
    4. I'd like to be able to save and restore that information as a user setting.

    Does Telerik have anything pre-built for any of that?  I've looked at the "Control Panel" sample and I don't think that would meet my definition of "little effort".

    Bradley
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
    commented on 31 Jan 2025, 07:46 PM

    No help available on this?

    1 Answer, 1 is accepted

    Sort by
    0
    Martin Ivanov
    Telerik team
    answered on 03 Feb 2025, 01:28 PM

    Hello Bradley,

    There are no behaviors that will allow you to fully enable the desired behaviors automatically without adjusting the control. However, you should be able to achieve your requirements by writing some custom code here and there. Here are my thoughts on the exact queries:

    (1) There is a relatively easy solution for listing the columns and controlling their visibility. You can find a runnable example showing this in the ColumnChooser SDK example. However, there is no automatic drag/drop in the column chooser custom example. You will need to manually implement such logic. You can do this by customizing the drag/drop in RadListBox and modify the DisplayIndex of the columns on drag/drop complete.

    (2) The column grouping is displayed on top of the control by default and you can reorder the groups in their parent panel. Also, you can disable (remove) and enable (add_ the groups using the built-in UI (via drag/drop and the close button). If that doesn't work for you, can you describe what exactly should the desired grouping settings and UI behave? Some screenshots showing the desired functionality will be helpful.

    (3) To set the column width, you can set Width property of the associated GridViewColumn object. The user can also change the width using the mouse (by dragging the border between two columns). And to set the sort direction, you can use the SortingState property of the GridViewColumn object. However, I am not sure what you mean by saying that this is leading up to saving. Can you describe this?

    (4) To save the RadGridView settings, you can use the PersistenceFramework. This approach is shown in the following SDK example.

    Regards,
    Martin Ivanov
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Tags
    GridView
    Asked by
    Bradley
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
    Answers by
    Martin Ivanov
    Telerik team
    Share this question
    or