0

A little background on how my grid works:

My grid is making use of .Sortable(), .Reorderable(), .Filterable() and .ColumnMenu(). On the dataBound event, the grid saves the state of the grid (column order, items per page, current pagination page, and column sorting [asc and desc]). This is so when a user comes back to that page, their settings are reloaded in the grid when some initializing Javascript makes a query on the grid.

My issue comes into play when I have the same data for two columns:

@(Html.Kendo().Grid<GridDataType>()
    .Name("ActiveThreats_Grid")
    .AutoBind(false)
    .Columns(columns =>
    {
      columns.Bound(r => r.Id).Title("<input id='checkAll', type='checkbox', class='check-box' />")
          .Sortable(false)
          .ClientTemplate("<input type='checkbox' class='check_row' id='#= Id#' />")
          .Filterable(false);

      columns.Bound(r => r.OtherField).Title("Other Field");

      columns.Bound(r => r.Id).Title("ID").Hidden(true);
    })
    .Resizable(resize => resize.Columns(true))
    .Scrollable()
    .Sortable()
    .Reorderable(reorder => reorder.Columns(true))
    .Filterable()
    .ColumnMenu()
    .DataSource(dataSource => dataSource
        .Ajax()
        // Other HtmlHelpers here
    )

What I've noticed, is if I have the same data-field attribute and I am using the .Reorderable() HtmlHelper, the grid reorders the first r.Id column to the same position where the second r.Id column appears.

Q: Is there an HtmlHelper or way to change the data-field attribute output to prevent .Reorderable() from ordering the two identical columns next to each other?

Fillip Peyton
  • 3,637
  • 2
  • 32
  • 60
  • Hi @Fillip, apologies for my misunderstanding of the question and I have taken down my solution as it wasn't linked to the question. – D_Learning Jul 24 '14 at 10:51
  • Can you please verify if this is what you are looking for: http://dojo.telerik.com/IteH – D_Learning Jul 24 '14 at 11:34
  • Close... That is the functionality I'm using (though, I'm init'ing it via the Kendo ASP.NET wrapper rather than JS), but I was looking to some how change/specify the data-field attribute for a given column. Preferably in the Kendo ASP.NET wrapper. – Fillip Peyton Jul 24 '14 at 17:38

0 Answers0