This is a migrated thread and some comments may be shown as answers.

Grid is filtering the next column

4 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 28 Jul 2015, 04:10 PM

I have a MVC grid and it seems that if I pick a column to sort it actually sorts the column to the right.

 Below is my razor code.  Not sure why this is happening.

 

Thanks,

Matthew

@(Html.Kendo().Grid(Model)
.Columns(columns =>
{     columns.Bound("").Locked(true).Filterable(true).Sortable(false).ClientTemplate("imagePath;").Width(75).Title("").Groupable(false);;      columns.Bound(c => c.Code).Title("Code");
columns.Bound(c => c.ShortName).Title("ShortName");
columns.Bound(c => c.Name).Title("Name");
columns.Bound("").ClientTemplate("#=Description#, #=Comment#).Title("Desc");columns.Bound("").Locked(true).HtmlAttributes(new { @class = "k-group-cell" }).Width(60).Title("").Filterable(false).Sortable(false).Groupable(false).ClientTemplate();
})
.Groupable()
.Filterable()
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Cell))
.Sortable(sortable => sortable
 .SortMode(GridSortMode.MultipleColumn))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource =>dataSource
 .Ajax()
 .Sort(sort => sort.Add("Code").Ascending())
 .PageSize(50)
 .ServerOperation(false)
)
)

4 Answers, 1 is accepted

Sort by
0
Accepted
eo
Top achievements
Rank 1
answered on 28 Jul 2015, 06:16 PM

Hello Matthew,

After playing around a little with your code sample I noticed that the behavior is being caused by the .Locked(true) in the fifth column. I don't now what the default behavior should be when trying to sort columns that are locked, but my common sense tells me that those two features don't get along with each other.

0
eo
Top achievements
Rank 1
answered on 28 Jul 2015, 06:17 PM
Sorry, I meant sixth column.
0
eo
Top achievements
Rank 1
answered on 28 Jul 2015, 06:23 PM
Ok, here it is, according to the documentation column locking is not to be used in combination with bindings in column templates.
0
Paul
Top achievements
Rank 1
answered on 28 Jul 2015, 06:35 PM
great thanks.  that did the trick
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
eo
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Share this question
or