簡體   English   中英

更改列標題Treelist KendoUI

[英]Change column header Treelist KendoUI

我希望能夠更改由年份選擇器onChange動態觸發的列標題,但找不到合適的樣式來處理它。

我嘗試通過檢查檢查元素進行修改,但是它也沒有起作用。

在此處輸入圖片說明

而我的代碼:

      $("#monthpicker").kendoDatePicker({
            start: "year",
            depth: "year",
            format: "yyyy",
            dateInput: true,

            change: function() {
                    var year = kendo.toString($("#monthpicker").data("kendoDatePicker").value(), 'yyyy');
                    $("#treelist").data("kendoTreeList").dataSource.read({start: year});
                    $(".k-grid-header th.k-header:first-child").text(year);

            }
        });

它應該像這樣:(只需在Month列上方的列標題上進行更改)

在此處輸入圖片說明

有沒有人對此有經驗? 謝謝。

您的查詢.k-grid-header th.k-header:first-child選擇了錯誤的標題。

我建議將headerTemplate與占位符一起使用,例如:

headerTemplate: function(x) { 
    return '<span class="year-goes-here"></span>'
}

然后通過以下方式設置年份:

$("#treelist").find(".year-goes-here").text(2018)

工作示例: https : //dojo.telerik.com/uXuwIDeK

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM