)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to change the measure name in the PivotGrid?

Platform: jQuery |
Control: ejPivotClient |
Published Date: July 16, 2015 |
Last Revised Date: June 17, 2019

This KB illustrates that how to change the measure name in PivotGrid.

Solution:

In order to customize the measure name in the PivotGrid, refer to the following steps.

Step 1:

JSON data is framed based on the information such as current OlapReport and grid layout. The JSON data contains

  • Updated and current OlapReport
  • Values besides row header, column header, value cell and summary cell in the PivotGrid.

Step 2:

Once JSON records are framed by using the GetJsonData method, it is sent back to the client side for PivotGrid rendering. Here the measure name can be change as per the requirement.

Step 3:

On interrupting, values that are bound to PivotGrid for view are available in the dictionary under the key name PivotRecords. These values are extracted back and de-serialized.  

Step 4:

Now, the de-serialized values are iterated. When the required measure name is found, it can be changed as desired.

C#

public Dictionary<string, object> InitializeGrid(string action, string currentReport, string gridLayout, string customObject)
{
    OlapDataManager DataManager = new OlapDataManager(connectionString);                               
    DataManager.SetCurrentReport(OLAPUTILS.Utils.DeserializeOlapReport(currentReport));
    var serJSON = olapClientHelper.GetJsonData(action, DataManager, gridLayout);
    var desJSON = serializer.Deserialize<List<Dictionary<string, string>>>(serJSON["PivotRecords"].ToString());
    foreach (var item in desJSON)
    {
        if (item["Value"] == "Customer Count")
        {
            item["Value"] = "#Customer"; break;             
        }
        serJSON["PivotRecords"] = serializer.Serialize(desJSON);
        return serJSON;
    }
}

 

VB

Public Function InitializeGrid(ByVal action As String, ByVal currentReport As String, ByVal gridLayout As String, ByVal customObject As String) As Dictionary(Of String, Object)
Dim DataManager As OlapDataManager = New OlapDataManager(connectionString)
DataManager.SetCurrentReport(OLAPUTILS.Utils.DeserializeOlapReport(currentReport))
Dim serJSON = olapClientHelper.GetJsonData(action, DataManager, gridLayout)
Dim desJSON = serializer.Deserialize(Of List(Of Dictionary(Of String, String)))(serJSON("PivotRecords").ToString())
For Each Dim item In desJSON
 If item("Value") = "Customer Count" Then
  item("Value") = "#Customer"
  Exit For
 End If
Next item
serJSON("PivotRecords") = serializer.Serialize(desJSON)
Return serJSON
End Function

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon