Hyperlink
21 Dec 202220 minutes to read
The pivot table supports to show hyperlink option to link data for individual cells that are displayed in the component. Also, the hyperlink can be enabled separately for row headers, column headers, value cells, and summary cells using the e-hyperlinkSettings tag. It can be configured through code behind, during initial rendering and the settings available to show hyperlink are:
-
showHyperlink: It allows to set the visibility of hyperlink in all cells. -
showRowHeaderHyperlink: It allows to set the visibility of hyperlink in row headers. -
showColumnHeaderHyperlink: It allows to set the visibility of hyperlink in column headers. -
showValueCellHyperlink: It allows to set the visibility of hyperlink in value cells. -
showSummaryCellHyperlink: It allows to set the visibility of hyperlink in summary cells. -
headerText: It allows to set the visibility of hyperlink based on header text. -
conditionalSettings: It allows to set the visibility of hyperlink based on specific condition.
NOTE
By default, the hyperlink options are disabled for all cells in the pivot table.
NOTE
User defined style can be applied to hyperlink using
cssClassproperty ine-yperlinkSettingstag.
Hyperlink for all cells
The pivot table has an option to show hyperlink option for all cells that are currently in display. To do so, user need to set showHyperlink to true.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings showHyperlink="true"></e-hyperlinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
return View();
}
Hyperlink for row headers
The pivot table has an option to show hyperlink option for row header cells alone that are currently in display. To do so, user need to set showRowHeaderHyperlink to true.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings showRowHeaderHyperlink="true"></e-hyperlinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
return View();
}
Hyperlink for column headers
The pivot table has an option to show hyperlink option for column header cells alone that are currently in display. To do so, user need to set showColumnHeaderHyperlink to true.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings showColumnHeaderHyperlink="true"></e-hyperlinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
return View();
}
Hyperlink for value cells
The pivot table has an option to show hyperlink option for value cells alone that are currently in display. To do so, user need to set showValueCellHyperlink to true.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-drilledmembers>
<e-field name="Country" items="@ViewBag.countryMembers"></e-field>
<e-field name="Year" items="@ViewBag.yearMembers"></e-field>
</e-drilledmembers>
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings showValueCellHyperlink="true"></e-hyperlinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
ViewBag.yearMembers = new string[] { "FY 2015" };
ViewBag.countryMembers = new string[] { "France" };
return View();
}
Hyperlink for summary cells
The pivot table has an option to show hyperlink option for summary cells alone that are currently in display. To do so, user need to set showSummaryCellHyperlink to true.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-drilledmembers>
<e-field name="Country" items="@ViewBag.countryMembers"></e-field>
<e-field name="Year" items="@ViewBag.yearMembers"></e-field>
</e-drilledmembers>
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings showSummaryCellHyperlink="true"></e-hyperlinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
ViewBag.yearMembers = new string[] { "FY 2015" };
ViewBag.countryMembers = new string[] { "France" };
return View();
}
Condition based hyperlink
The pivot table has an option to show hyperlink in the cells based on specific conditions. It can be configured using the conditionalSettings tag through code behind, during initial rendering. The settings required are:
-
measure: Specifies the value field name, in-order to set the visibility of hyperlink for the same when condition is met. -
conditions: Specifies the operator type such as Equals, GreaterThan, LessThan, etc. -
value1: Specifies the start value. -
value2: Specifies the end value.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-drilledmembers>
<e-field name="Country" items="@ViewBag.countryMembers"></e-field>
<e-field name="Year" items="@ViewBag.yearMembers"></e-field>
</e-drilledmembers>
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings>
<e-conditionalsettings>
<e-format measure="Sold" conditions="Between" value1="100" value2="200"></e-format>
</e-conditionalsettings>
</e-hyperLinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
ViewBag.yearMembers = new string[] { "FY 2015" };
ViewBag.countryMembers = new string[] { "France" };
return View();
}
Condition based hyperlink for specific row or column
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 tag 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. -
conditions: Specifies the operator type such as Equals, GreaterThan, LessThan, etc. -
value1: Specifies the start value. -
value2: Specifies the end value.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-drilledmembers>
<e-field name="Country" items="@ViewBag.countryMembers"></e-field>
<e-field name="Year" items="@ViewBag.yearMembers"></e-field>
</e-drilledmembers>
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings>
<e-conditionalsettings>
<e-format label="Germany" conditions="Between" value1="500"></e-format>
</e-conditionalsettings>
</e-hyperLinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
ViewBag.yearMembers = new string[] { "FY 2015" };
ViewBag.countryMembers = new string[] { "France" };
return View();
}Header based hyperlink
The pivot table has an option to show hyperlink in the cells based on specific row or column header. It can be configured using the headerText option through code behind, during initial rendering.
<ejs-pivotview id="PivotView" height="300">
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-drilledmembers>
<e-field name="Country" items="@ViewBag.countryMembers"></e-field>
<e-field name="Year" items="@ViewBag.yearMembers"></e-field>
</e-drilledmembers>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings headerText= "FY 2015.Q1.Units Sold"></e-hyperlinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
ViewBag.yearMembers = new string[] { "FY 2015" };
ViewBag.countryMembers = new string[] { "France" };
return View();
}
Event
The event hyperlinkCellClick fires on every hyperlink cell click.
It has following parameters - cancel and currentCell. The parameter currentCell is used to customize the host cell element by any means. Meanwhile, when the parameter cancel is set to true, applied customization will not be updated to the host cell element.
<ejs-pivotview id="PivotView" height="300" hyperLinkCellClick="hyperlink")>
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
<e-formatsettings>
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
</e-formatsettings>
<e-rows>
<e-field name="Country"></e-field>
<e-field name="Products"></e-field>
</e-rows>
<e-columns>
<e-field name="Year" caption="Year"></e-field>
<e-field name="Quarter"></e-field>
</e-columns>
<e-values>
<e-field name="Sold" caption="Units Sold"></e-field>
<e-field name="Amount" caption="Sold Amount"></e-field>
</e-values>
</e-datasourcesettings>
<e-hyperlinkSettings showRowHeaderHyperlink="true"></e-hyperlinkSettings>
</ejs-pivotview>public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
return View();
}