Apply condition based hyper link for specific row or column in Vue Pivotview component
11 Jun 20245 minutes to read
You can apply conditions for specific row or column using label
option to show hyperlink option in the pivot table. It can be configured using the conditionalSettings
option through code behind, during initial rendering. The required settings are:
-
label
: Specifies the header name to get visibility of hyperlink option for row or column. -
condition
: Specifies the operator type such as equals, greater than, less than, etc. -
value1
: Specifies the start value. -
value2
: Specifies the end value.
<template>
<div id="app">
<ejs-pivotview :height="height" :dataSourceSettings="dataSourceSettings" :hyperlinkSettings="hyperlinkSettings">
</ejs-pivotview>
</div>
</template>
<script setup>
import { PivotViewComponent as EjsPivotview } from "@syncfusion/ej2-vue-pivotview";
import { pivotData } from './pivotData.js';
const dataSourceSettings = {
dataSource: pivotData,
expandAll: false,
enableSorting: true,
drilledMembers: [{ name: 'Year', items: ['FY 2015'] }, { name: 'Country', items: ['France'] }],
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }],
rows: [{ name: 'Country' }, { name: 'Products' }],
formatSettings: [{ name: 'Amount', format: 'C0' }],
filters: []
};
const height = 350;
const hyperlinkSettings = {
conditionalSettings: [{
label: 'Germany',
conditions: 'GreaterThan',
value1: 500
}],
cssClass: 'e-custom-class'
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-pivotview/styles/material.css";
.e-custom-class {
color: #008cff;
text-decoration: underline;
}
.e-custom-class:hover {
color: red;
text-decoration: none;
}
</style>
<template>
<div id="app">
<ejs-pivotview :height="height" :dataSourceSettings="dataSourceSettings" :hyperlinkSettings="hyperlinkSettings">
</ejs-pivotview>
</div>
</template>
<script>
import { PivotViewComponent } from "@syncfusion/ej2-vue-pivotview";
import { pivotData } from './pivotData.js';
export default {
name: "App",
components: {
"ejs-pivotview": PivotViewComponent
},
data() {
return {
dataSourceSettings: {
dataSource: pivotData,
expandAll: false,
enableSorting: true,
drilledMembers: [{ name: 'Year', items: ['FY 2015'] }, { name: 'Country', items: ['France'] }],
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }],
rows: [{ name: 'Country' }, { name: 'Products' }],
formatSettings: [{ name: 'Amount', format: 'C0' }],
filters: []
},
height: 350,
hyperlinkSettings: {
conditionalSettings: [{
label: 'Germany',
conditions: 'GreaterThan',
value1: 500
}],
cssClass: 'e-custom-class'
}
}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-pivotview/styles/material.css";
.e-custom-class {
color: #008cff;
text-decoration: underline;
}
.e-custom-class:hover {
color: red;
text-decoration: none;
}
</style>