翻譯|使用教程|編輯:龔雪|2021-03-19 10:43:00.467|閱讀 243 次
概述:本文主要介紹通過Kendo UI的PivotGrid控件,您可以控制尺寸標(biāo)簽呈現(xiàn)的內(nèi)容格式。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Kendo UI for jQuery R1 2021 SP1試用版下載
Kendo UI是帶有jQuery、Angular、React和Vue庫的JavaScript UI組件的最終集合,無論選擇哪種JavaScript框架,都可以快速構(gòu)建高性能響應(yīng)式Web應(yīng)用程序。通過可自定義的UI組件,Kendo UI可以創(chuàng)建數(shù)據(jù)豐富的桌面、平板和移動Web應(yīng)用程序。通過響應(yīng)式的布局、強大的數(shù)據(jù)綁定、跨瀏覽器兼容性和即時使用的主題,Kendo UI將開發(fā)時間加快了50%。
通過PivotGrid,您可以控制尺寸標(biāo)簽呈現(xiàn)的內(nèi)容格式。
通過在行或標(biāo)題模板中實現(xiàn)自定義模板,可以實現(xiàn)此操作。
下面的示例演示如何在PivotGrid中格式化維度標(biāo)簽的日期值。
<script src="http://demos.telerik.com/kendo-ui/content/shared/js/products.js"></script> <div id="example"> <div id="pivotgrid"></div> <div class="responsive-message"></div> <script id="rowTemplate" type="text/x-kendo-template"> # if (member.name.indexOf("LastSupply") === 0 && member.name !== "LastSupply") { # #: kendo.toString(kendo.parseDate(member.caption), "d") # # } else { # #: member.caption # # } # </script> <script> $(document).ready(function () { var d = new Date(); products.forEach(function(p) { p.LastSupply = new Date(d); d.setDate(d.getDate() + 1); }); var pivotgrid = $("#pivotgrid").kendoPivotGrid({ columnWidth: 120, height: 570, rowHeaderTemplate: $("#rowTemplate").html(), dataSource: { data: products, schema: { model: { fields: { ProductName: { type: "string" }, UnitPrice: { type: "number" }, UnitsInStock: { type: "number" }, Discontinued: { type: "boolean" }, LastSupply: { type: "date" }, CategoryName: { field: "Category.CategoryName" } } }, cube: { dimensions: { ProductName: { caption: "All Products" }, CategoryName: { caption: "All Categories" }, Discontinued: { caption: "Discontinued" } }, measures: { "Sum": { field: "UnitPrice", format: "{0:c}", aggregate: "sum" }, "Average": { field: "UnitPrice", format: "{0:c}", aggregate: "average" } } } }, columns: [{ name: "CategoryName", expand: true }, { name: "ProductName" } ], rows: [{ name: "Discontinued", expand: true }, { name: "LastSupply", expand: false }], measures: ["Sum"] } }).data("kendoPivotGrid"); }); </script> </div>
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都網(wǎng)