Disable row selection in mvc and Enable column selection in mvc kendo grid

716 Views Asked by At

I want to Disable the row selection and enable only column selection kendo grid MVC. Here is my code. I want to select the kendo grid cells only now the whole row like I want only the coordinates.

columns.Bound(p => p.H).HtmlAttributes(new { title = "#= H #" });
columns.Bound(p => p.I).HtmlAttributes(new { title = "#= I #" });
columns.Bound(p => p.J).HtmlAttributes(new { title = "#= J #" });
columns.Bound(p => p.K).HtmlAttributes(new { title = "#= K #" });
columns.Bound(p => p.L).HtmlAttributes(new { title = "#= L #" });
columns.Bound(p => p.M).HtmlAttributes(new { title = "#= M #" });
columns.Bound(p => p.N).HtmlAttributes(new { title = "#= N #" });
columns.Bound(p => p.O).HtmlAttributes(new { title = "#= O #" });
columns.Bound(p => p.P).HtmlAttributes(new { title = "#= P #" });
columns.Bound(p => p.Q).HtmlAttributes(new { title = "#= Q #" });
columns.Bound(p => p.R).HtmlAttributes(new { title = "#= R #" });
columns.Bound(p => p.S).HtmlAttributes(new { title = "#= S #" });
columns.Bound(p => p.T).HtmlAttributes(new { title = "#= T #" });
columns.Bound(p => p.U).HtmlAttributes(new { title = "#= U #" });
columns.Bound(p => p.V).HtmlAttributes(new { title = "#= V #" });
columns.Bound(p => p.W).HtmlAttributes(new { title = "#= W #" });
columns.Bound(p => p.X).HtmlAttributes(new { title = "#= X #" });
columns.Bound(p => p.Y).HtmlAttributes(new { title = "#= Y #" });
columns.Bound(p => p.Z).HtmlAttributes(new { title = "#= Z #" });
})

.Selectable(s => s.Mode(GridSelectionMode.Single))
  .Scrollable()
  .Navigatable()
  .HtmlAttributes(new { style = "cursor:pointer;height:860px;width:1120px;" })
  .DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("GetDefaultPlotSitePlan", "Grid")))
  .Events(e => e.DataBound("onDataBoundSitePlanPlot").Change("onSelectSitePlanRow").Navigate("onRowNavigateUsingKeyboard"))
)
1

There are 1 best solutions below

0
Shai On

You should state that the selection type is cell, like this:

.Selectable(s => s
    .Mode(GridSelectionMode.Single)
    .Type(GridSelectionType.Cell))