Articles in this section

How to get measure details in client side when clicking value cell?

This KB illustrates that how to get measure details in client side when clicking value cell.

Solution:

The Following code describes on getting measure details behind each value cell using valueCellHyperlinkClick event.

JavaScript

$(function () {
$("#PivotGrid").ejPivotGrid({
url: "/wcf/PivotGridService.svc", enableValueCellHyperlink: true, valueCellHyperlinkClick: "hyperlinkEvent"
});
});
function hyperlinkEvent(e) {
var gridObj = $("#PivotGrid").data("ejPivotGrid")
$.ajax({
type: "POST",
url: "/wcf/PivotGridService.svc/HyperlinkManipulation",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify({ cellPosition: e.cellPosition, olapReport: gridObj.getOlapReport() }),
success: function (val) {
//Getting measure details here
alert(val.d);
},
complete: null,
error: null
});
}

 

ASP

<ej:PivotGrid ID="OlapChart1" runat="server" Url="../wcf/PivotGridtService.svc">
<ClientSideEvents  ValueCellHyperlinkClick="hyperlinkEvent"/>
</ej:PivotGrid>
<script type="text/javascript">
function hyperlinkEvent(e) {
var gridObj = $("#PivotGrid").data("ejPivotGrid")
$.ajax({
type: "POST",
url: "/wcf/PivotGridService.svc/HyperlinkManipulation",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify({ cellPosition: e.cellPosition, olapReport: gridObj.getOlapReport() }),
success: function (val) {
//Getting measure details here
alert(val.d);
},
complete: null,
error: null
});
}
<script/>

 

MVC

@Html.EJ().Olap().PivotGrid("PivotGrid1").Url(Url.Content("~/wcf/PivotGridService.svc")).ClientSideEvents(clientSideEvent => clientSideEvent.ValueCellHyperlinkClick("hyperlinkEvent"))
<script type="text/javascript">
function hyperlinkEvent(e) {
var gridObj = $("#PivotGrid").data("ejPivotGrid")
$.ajax({
type: "POST",
url: "/wcf/PivotGridService.svc/HyperlinkManipulation",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify({ cellPosition: e.cellPosition, olapReport: gridObj.getOlapReport() }),
success: function (val) {
//Getting measure details here
alert(val.d);
},
complete: null,
error: null
});
}
<script/>

 

C#

public string HyperlinkManipulation(string cellPosition, string olapReport)
{
OlapDataManager DataManager = new OlapDataManager(connectionString);
DataManager.SetCurrentReport(Utils.DeserializeOlapReport(olapReport));
var pEngine = DataManager.ExecuteOlapTable(Syncfusion.Olap.Engine.GridLayout.NormalTopSummary);
string[] indexVal = cellPosition.Split(new char[] { ',' });
Syncfusion.Olap.Engine.PivotCellDescriptor selectedCellData = pEngine.TableColumns[Convert.ToInt32(indexVal[0])].Cells[Convert.ToInt32(indexVal[1])];
string cellValue = selectedCellData.CellValue;
return selectedCellData.CellData.Measure;
}

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied