Hi there,
I just moved from Telerik MVC to Kendo. Quite a learning curve.
I'm having a strange problem, where I have set sort on the DataSource, the data being sorted correctly, just the sort icon doesn't show up on the column header, see attached thumbnail, .
javascript
Grid
I tried to hack the sort icon in databound event as following. After grid loaded, I click on column header, I always get two sort icons, see attached 'duplicate sort icons'. I tried to append "<span class='k-icon k-i-arrow-n'></span>", the icon does not show. I tried "<span class='k-icon'></span>", but it displays two icons.
Hack in databound event
any suggestion?
thanks in advance
regards
Jerry
I just moved from Telerik MVC to Kendo. Quite a learning curve.
I'm having a strange problem, where I have set sort on the DataSource, the data being sorted correctly, just the sort icon doesn't show up on the column header, see attached thumbnail, .
javascript
standardGrid.dataSource.sort({ field: "ProjectName", dir: "dsc" });Grid
@(Html.Kendo().Grid<CorporateSys.Data.GetProjectsByIdBusinessUnitIdsUserIdTagged_Result>().Name("ProjectStandardGrid").HtmlAttributes(new { style = "display:inline-block; height:100%; clear:both;" }).Columns(columns =>{ columns.Bound(c => c.ProjectId).Hidden(); columns.Bound(c => c.ProjectName); columns.Bound(c => c.ProjectType);}).Filterable() .Groupable().Sortable().DataSource(ds => ds.Ajax() .Read("GetJobs", "Job", new { isBau = Model.IsBau, clientId = Model.ClientId }) .ServerOperation(true) .PageSize(20)) .Events(events=>events.DataBound("OnStandardGridDataBound")) .Pageable())I tried to hack the sort icon in databound event as following. After grid loaded, I click on column header, I always get two sort icons, see attached 'duplicate sort icons'. I tried to append "<span class='k-icon k-i-arrow-n'></span>", the icon does not show. I tried "<span class='k-icon'></span>", but it displays two icons.
Hack in databound event
function OnStandardGridDataBound(e) { var grid = $("#ProjectStandardGrid").data("kendoGrid"); var th = grid.thead.find(".k-link"); th.find('span').remove(); var sortSettings = grid.dataSource._sort; if (sortSettings != "" && sortSettings != null) { for (var i = 0; i < sortSettings.length; i++) { var sort = sortSettings[i]; var thSort = grid.thead.find("th[data-field='" + sort.field + "'] .k-link"); if (sort.dir == "dsc") { //thSort.append("<span class='k-icon k-i-arrow-n'></span>"); //k-i-arrow-s thSort.append("<span class='k-icon'></span>"); //k-i-arrow-s } else if (sort.dir == "asc") { thSort.append("<span class='k-icon'></span>"); //k-i-arrow-s } } }any suggestion?
thanks in advance
regards
Jerry