Grid columns user preference

4 posts, 1 answers
  1. Murali
    Murali avatar
    5 posts
    Member since:
    Jun 2016

    Posted 28 Jul Link to this post

    I would like to let user hide columns in the grid they don't want and order columns in the grid the way they want. Right now we have the feature to hide the column in the grid(through code) but user cannot do that. Is there a way to let the user hide the column with a cancel button so that I will save that column preference data in the database to hide that column for the user when he logs in the next time and also I would like to let the user order the columns in the grid by dragging and drop. Thanks
  2. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 01 Aug Link to this post

    Hi Murali,

    You can set the Grid's reorderable option to true to allow column reordering:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-reorderable

    As for allowing the user to hide/show columns, you can use the columnMenu option:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columnMenu

    The following online demos illustrate the discussed functionalities:

    http://demos.telerik.com/kendo-ui/grid/column-reordering

    http://demos.telerik.com/kendo-ui/grid/column-menu

    I hope this helps.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Kendo UI is VS 2017 Ready
  4. Murali
    Murali avatar
    5 posts
    Member since:
    Jun 2016

    Posted 16 Aug in reply to Dimiter Topalov Link to this post

    Hi Dimiter,

    I see that we can order the columns, hide/show columns. Now I have a different question is there a predefined way to get the selected/unselected columns so that I will save those preferences for user and replicate the same when the user logs in next time.

    Regards

    Murali

  5. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 18 Aug Link to this post

    Hi Murali,

    In case you mean the selected/unselected columns in the column menu, then you can obtain the column visibility state from the Grid columns field:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#fields-columns

    Iterate the array of column objects and check if there is a hidden field with a true value for each of them.

    You can also utilize the columnHide and columnShow events, if needed.

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-columnHide
     
    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-columnShow

    Regards,
    Dimo
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top
Kendo UI is VS 2017 Ready