Hi,
I use filtering on kendo grid in row mode. This works fine, except one detail. I want to have the list sorted, not in that order you can see in the attached screen. I've noticed that if I changed the sort option to "Sort(sort => sort.Add("ClientName")", the autocomplete would get the items alphabetically. But what about another fields, where I also want to have the right order. And of course I don't want to change the global order.
@(Html.Kendo().Grid<
PostTaskModel
>().Name("AktualneGrid")
.Columns(cols =>
{
cols.Bound(p => p.CaseNumber).Width(80).ClientTemplate("#=gotoTaskWindow(data.CaseNumber, data.Ident)#")
.HtmlAttributes(new { @class = "link-cell" }).Locked().Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
cols.Bound(p => p.Subject).Width(200).ClientTemplate("<
b
>#=Subject#</
b
>").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
cols.Bound(p => p.DocumInfo).Width(50).Title("Niep.wiad.").ClientTemplate("#=BoldNotRead(data.DocumInfo, data.NoReadCnt)#");
cols.Bound(p => p.Description).Width(600).ClientTemplate("#:Truncate(Description, descLength)#").Title("Opis zgłoszenia . . . . .")
.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
cols.Bound(p => p.ModifyDate).Width(60).Format("{0:yyyy-MM-dd HH:mm}");
cols.Bound(p => p.Applicant).Width(100).Filterable(ftb => ftb.Multi(true));
cols.Bound(p => p.FinishTerm).Width(60).ClientTemplate("#=BoldBeforeNow(data.FinishTerm)#");
cols.Bound(p => p.EmployeeName).Width(100).Filterable(ftb => ftb.Multi(true));
cols.Bound(p => p.ClientName).Width(150).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
cols.ForeignKey(p => p.IssueKindId, (IEnumerable)ViewData["casetypes"], "Ident", "Description")
.Title("Nazwa rodzaju").Width(200).Filterable(ftb => ftb.Multi(true)).Hidden();
cols.ForeignKey(p => p.Priority, (IEnumerable)ViewData["priorities"], "Symbol", "Description")
.Title("Opis kategorii").Width(100).Filterable(ftb => ftb.Multi(true));
cols.Bound(p => p.ProductName).Width(200).Filterable(ftb => ftb.Multi(true));
})
.Sortable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.Pageable(pager => pager.PageSizes(new[] { 10, 15, 20, 30, 50 }).Input(true).Refresh(true))
.Groupable()
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.ColumnMenu()
.Navigatable()
.Selectable(sel => sel.Mode(GridSelectionMode.Multiple).Type(GridSelectionType.Cell))
.AllowCopy(true)
.HtmlAttributes(new { style = "min-width:1840px;" })
.Events(e => e.DataBound("gridFocusDataBound"))
.AutoBind(false)
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Model(model => model.Id(p => p.Ident))
.ServerOperation(false)
.Sort(sort => sort.Add("ModifyDate").Descending())
.Read(read => read.Action("Aktualne_Read", "Async").Data("filterGrid"))
.Events(events => events.Error("errorHandler"))
))
I will be grateful for your help
Josef