Getting Started with the Kendo UI for Vue PivotGrid
This guide provides essential information about using the Kendo UI for Vue PivotGrid. You will learn how to install the package, add a PivotGrid component to your project, style the component, and activate your license.
After completing this guide, you will be able to reproduce the following example.
Setting Up Your Vue Project
Before you install the Kendo UI for Vue PivotGrid, make sure that you have a running Vue project. The easiest way to set up a Vue project is to use the approach described in the Set up the Vue project section of the First Steps with JavaScript article.
Install the Component
To install the PivotGrid package, run the following command in the root folder of your Vue project:
npm i @progress/kendo-vue-pivotgrid
Importing the Component
After installing the package, import the PivotGrid component in the Vue App.
In the src/App.vue file of your Vue project, import the PivotGrid, PivotGridContainer and usePivotOLAPService from the PivotGrid package. The usePivotOLAPService composable binds the PivotGrid to an OLAP cube.
// ES2015 module syntax
import { PivotGrid, PivotGridContainer, usePivotOLAPService } from '@progress/kendo-vue-pivotgrid';
// CommonJS format
const { PivotGrid, PivotGridContainer, usePivotOLAPService } = require('@progress/kendo-vue-pivotgrid');
Using the Component
-
Define the
defaultColumnAxes,defaultRowAxesand thedefaultMeasureAxes. Each item is aPivotGridAxisobject that describes a single column, row, or measure axis.jsconst defaultColumnAxes = [ { name: ['[Date].[Calendar]'], expand: true }, { name: ['[Product].[Category]'] } ]; const defaultRowAxes = [{ name: ['[Geography].[City]'] }]; const defaultMeasureAxes = [{ name: ['[Measures].[Reseller Freight Cost]'] }]; -
Define the
catalog,cube, andurl.jsconst catalog = 'Adventure Works DW 2008R2'; const cube = 'Adventure Works'; const url = 'https://demos.telerik.com/service/v2/olap/msmdpump.dll'; -
Pass the configuration to the
usePivotOLAPServicecomposable in the<script setup>block of thesrc/App.vuefile.jsconst { pivotProps } = usePivotOLAPService({ catalog, cube, url, defaultRowAxes, defaultColumnAxes, defaultMeasureAxes }); -
Add the component's markup to the template section of the
src/App.vuefile in your project and set the desired properties.html<template> <PivotGridContainer> <PivotGrid v-bind="pivotProps" :style="{ height: '700px' }" :column="WideColumn" /> </PivotGridContainer> </template> -
To style the PivotGrid, install and import the Meridian theme, which is one of the five beautiful themes for Kendo UI for Vue.
-
Install the Meridian theme package.
shnpm i @progress/kendo-theme-meridian -
Import the Theme package in
src/App.vue.jsimport '@progress/kendo-theme-meridian/dist/all.css';
-
-
Build and run the application by typing the following command in the root folder of your project:
shnpm run dev -
Navigate to the URL displayed in the terminal to see the Kendo UI for Vue PivotGrid component on the page.
Activating Your License Key
Using any of the UI components in the Kendo UI for Vue library requires either a commercial license key or an active trial license key.
Follow the instructions on the My License page to activate your trial or commercial license. You can skip this step if your application already contains a Kendo UI for Vue license file.
Dependencies
The PivotGrid package requires you to install the following peer dependencies in your application:
| Package Name | Description |
|---|---|
| vue 3.0.0+ | Contains the functionality necessary to define Vue components. |
| @progress/kendo-licensing | Contains the internal infrastructure related to licensing. |
| @progress/kendo-data-query | Contains the data query helpers. |
| @progress/kendo-pivotgrid-common | Contains the framework-agnostic PivotGrid data processing and OLAP communication logic. |
| @progress/kendo-svg-icons | Contains the SVG icons for the components. |
| @progress/kendo-vue-common | Contains the common utilities of the Kendo UI for Vue suite. |
| @progress/kendo-vue-intl | Contains the Kendo UI for Vue Internationalization package that applies the desired cultures by providing services and pipes for the parsing and formatting of dates and numbers. |
| @progress/kendo-vue-animation | Contains the Kendo UI for Vue Animation components. |
| @progress/kendo-vue-buttons | Contains the Kendo UI for Vue Buttons components. |
| @progress/kendo-vue-dropdowns | Contains the Kendo UI for Vue DropDowns components. |
| @progress/kendo-vue-form | Contains the Kendo UI for Vue Form components. |
| @progress/kendo-vue-indicators | Contains the Kendo UI for Vue Indicators components. |
| @progress/kendo-vue-inputs | Contains the Kendo UI for Vue Inputs components. |
| @progress/kendo-vue-labels | Contains the Kendo UI for Vue Labels components. |
| @progress/kendo-vue-popup | Contains the Kendo UI for Vue Popup component. |
| @progress/kendo-vue-treeview | Contains the Kendo UI for Vue TreeView component. |