翻譯|使用教程|編輯:龔雪|2020-08-19 10:51:08.283|閱讀 244 次
概述:Kendo UI for jQuery是創建現代Web應用程序的最完整UI庫,本文Kendo UI Grid支持列模板,歡迎下載新版體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Kendo UI for jQuery R2 2020 SP1試用版下載
Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四個控件。Kendo UI for jQuery是創建現代Web應用程序的最完整UI庫。
Kendo UI Grid呈現代表數據源項的表行(tr)。
有關可運行的示例,請參閱:
每個表格行都包含代表Grid列的表格單元格(td)。 默認情況下,網格在列中顯示字段的HTML編碼值。
下面的示例演示如何自定義列顯示其值的方式。
將列模板設置為字符串
下面的示例演示如何將模板設置為字符串并將列值包裝在HTML中。
<div id="grid"></div> <script> $("#grid").kendoGrid({ columns: [ { field: "name", template: "<strong>#: name # </strong>" }], dataSource: [ { name: "Jane Doe" }, { name: "John Doe" } ] }); </script>
將列模板設置為函數
以下示例演示如何將模板設置為kendo.template返回的函數。
<div id="grid"></div> <script id="name-template" type="text/x-kendo-template"> <strong>#: name #</strong> </script> <script> $("#grid").kendoGrid({ columns: [ { field: "name", template: kendo.template($("#name-template").html()) }], dataSource: [ { name: "Jane Doe" }, { name: "John Doe" } ] }); </script>
下面的示例演示如何將模板設置為返回字符串的函數。
<div id="grid"></div> <script> $("#grid").kendoGrid({ columns: [ { field: "name", template: function(dataItem) { return "<strong>" + kendo.htmlEncode(dataItem.name) + "</strong>"; } }], dataSource: [ { name: "Jane Doe" }, { name: "John Doe" } ] }); </script>
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都網