Grid menu (hiding/showing columns) and columns defaulting to invisible/hidden

4 posts, 0 answers
  1. Dave
    Dave avatar
    35 posts
    Member since:
    Oct 2012

    Posted 14 Oct 2013 Link to this post

    I recently added Grid Column Menus to my grid, primarily to give the user the ability to hide/show columns.
    .ColumnMenu(menu => menu.Columns(true).Sortable(false))

    I want some columns hidden by default, and the user to have the ability to display them if needed. So, using the MVC helpers, I set Visible(false) like so:
    column.Bound(c => c.Submitter).Title("Submitter").Visible(false);
    However, to my surprise, columns hidden in this manner do not show up in the column menu. It's like they don't exist.

    I was able to get it working correctly by loading all columns as normal and then hiding certain ones via JavaScript:

    $(document).ready(function () {
        var grid = $('#issueGrid').data('kendoGrid');

    But I have 2 issues with this:
    A) There is some graphical stutter as the columns are noticably loaded and then hidden.
    B) I shouldn't have to do this. Setting a column as .Visible(false) should still have that column appear in the Menus.

    Is this a bug? Why does setting a column as .Visible(false) cause it to act like it does not exist, in regards to the Column Menu? I wish I didn't have to write 10+ extra lines of script to do this.

  2. Dave
    Dave avatar
    17 posts
    Member since:
    Jan 2009

    Posted 14 Oct 2013 Link to this post

    on the bound column set the IncludeInMenu true

    column.Bound(c => c.Submitter).Title("Submitter").Visible(false).IncludeInMenu(true)

    I use the Hidden instead of the Visible


    column.Bound(c => c.Submitter).Title("Submitter").Hidden(true).IncludeInMenu(true)
  3. Dimiter Madjarov
    Dimiter Madjarov avatar
    2272 posts

    Posted 15 Oct 2013 Link to this post


    As said above, in order to achieve this, you should use the Hidden(false) method instead of the Visible(false). This way the column will be included in the Grid's markup, but will be hidden initially.
    columns.Bound(o => o.ShipName).Hidden(true);

    Dimiter Madjarov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  4. Dave
    Dave avatar
    35 posts
    Member since:
    Oct 2012

    Posted 15 Oct 2013 Link to this post

    Interesting. Well, that works. Thanks.
Back to Top