PivotGrid概述
Kendo UI PivotGrid以跨表格格式表示多维数据。
PivotGrid是jQuery的剑道UI,一个具有 110+ 组件的专业级UI库,用于构建现代和功能丰富的 应用程序。想要试用它,请注册一个30天的免费试用。
Тhe new PivotGridV2现在可用。它提供了一个全新的设计和一个新的不受未来影响的体系结构,允许实现许多即将实现的功能。由于PivotGridV2旨在取代传统的PivotGrid,建议在您的新项目中使用PivotGridV2。关于PivotGrid和PivotGridV2之间区别的信息,请参阅比较篇文章。
基本配置
从PivotGrid小部件的初始化开始。通过定义HTML创建小部件
元素。<!——定义HTML div来保存PivotGrid——>
配置PivotGrid以使用托管在上面的Adventure Works多维数据集https://demos.telerik.com.
<脚本>美元(文档)。准备(函数(){$("#pivotgrid")。kendoPivotGrid({height: 200, //定义小部件的高度。dataSource: {type: "xmla", //定义类型。列:[{名称:"[日期]。[日历]"}],//指定列的维度。行:[{名称:"[产品]。[类别]"}],//指定行的维度。措施:["(措施)。[网络销售额]"],//指定显示指标。 transport: { connection: { catalog: "Adventure Works DW 2008R2", // Specify the name of the catalog. cube: "Adventure Works" // Specify the name of the cube. }, read: { url: "https://demos.telerik.com/olap/msmdpump.dll", // Define the URL of the service. dataType: "text", contentType: "text/xml", type: "POST" } }, schema: { type: "xmla" // Specify the type of the schema. }, } }); });
前面的示例输出以下结果。
功能和特性
引用现有实例
要引用现有的PivotGrid实例,请使用jQuery.data ()
方法。一旦建立了引用,就使用PivotGrid API控制它的行为。
下面的示例演示如何访问一个现有的PivotGrid实例。
var pivotgrid = $("#pivotgrid").data("kendoPivotGrid");