ColumnMenu Undefined Columns

4 posts, 0 answers
  1. Matteo
    Matteo avatar
    2 posts
    Member since:
    May 2011

    Posted 07 May 2013 Link to this post

    Hi,
    I'm using ASP.NET MVC Wrapper for KendoUI in my project.
    I saw Grid ColumnMenu and I want to use it and it works everything but the menu lists 3 undefined columns. My grid has 3 columns without model binding and with empty title but I set this
    .IncludeInMenu(false)
    but nothing changes. So I've tried to comment those columns but nothing changes again.
    How can I solve this problem?

    Thanks,
    Matteo.
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 09 May 2013 Link to this post

    Hello Matteo,

    What version of the framework do you use? I tried on my side (the latest internal build) the following setup:

    @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.Order>()
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.OrderID);
            columns.Bound(o => o.ShipCountry);
            columns.Bound(o => o.ShipName);
            columns.Template(@<text></text>).ClientTemplate("test");
            columns.Bound(o => o.ShipAddress).Filterable(false);
        })
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("ColumnMenu_Read", "Grid"))
         )
        .Pageable()
        .Filterable()
        .Sortable()
        .ColumnMenu()
    )

    And The column is not displayed at the column menu until I specify a title. Could you try to update to the latest version (or latest internal build) and see if the problem persists?

    Kind Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Matteo
    Matteo avatar
    2 posts
    Member since:
    May 2011

    Posted 09 May 2013 Link to this post

    Hi Petur,
    My KendoUI version is "2013.1.319.340".
    My grid code is this:

    Html.Kendo().Grid(Model).Name("Grid")
    .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("", "").Data("")).Model(model => model.Id(m => m.ID)).PageSize(50).Events(events => events.RequestStart("")))
    .Columns(columns =>
    {
        columns.Template(o => "").ClientTemplate("").HtmlAttributes(new { @style = "white-space: nowrap;" }).Width(100).IncludeInMenu(false);
     
        columns.Template(o => "").Width(36).HeaderTemplate(h => "").HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("").IncludeInMenu(false);
     
        columns.Template(o => "").Width(36).HtmlAttributes(new { style = "text-align:center" }).HeaderTemplate("").ClientTemplate("").IncludeInMenu(false);
     
        Html.OrderedColumns(columns);
    })
    .Selectable()
    .Scrollable(scrolling => scrolling.Enabled(true).Height(300))
    .Resizable(resizing => resizing.Columns(true))
    .Reorderable(reorderable => reorderable.Columns(true))
    .ColumnMenu()
    .Sortable(sorting => sorting.Enabled(true).SortMode(GridSortMode.SingleColumn).AllowUnsort(true))
    .Pageable(pageable => pageable.Enabled(true).Messages(t => t.Display("{0:d0} - {1:d0} of {2:d0} items")))
    .Filterable(filtering => filtering.Enabled(false))
    .Events(e => e.DataBound("").ColumnResize("").ColumnHide("").ColumnShow("").ColumnReorder(""))
    The code "Html.OrderedColumns(columns);" renders the columns with Bound sorted by user settings. If I comment the 3 columns set in grid that you can see here undefined columns appears anyway.

    Regards,
    Matteo
  4. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 13 May 2013 Link to this post

    Hello Matteo,

    I am not able to reproduce such behavior. Could you please check the attached project and modify it in a way it reproduces the case, so we can search for a solution?

    Kind Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top