|
$(function () {
$("#PivotGrid1").ejPivotGrid({
dataSource: {
//Datasource bound to PivotGrid control.
data: pivotData,
//Required fields in row, column, value and filter areas of PivotGrid control.
rows: [{ fieldName: "Country", fieldCaption: "Country" }],
columns: [{ fieldName: "Product", fieldCaption: "Product" }],
values: [{ fieldName: "Amount" , fieldCaption: "Amount" }]
},
renderSuccess: "RenderFieldList",
});
});
function RenderFieldList(args) {
$("#PivotSchemaDesigner1").ejPivotSchemaDesigner({
pivotControl: args,
layout: ej.PivotSchemaDesigner.Layouts.Excel
});
var fieldMembers = $("#PivotSchemaDesigner1").data("ejPivotSchemaDesigner").model.pivotTableFields;
var treeviewList = $("#PivotSchemaDesigner1").data("ejPivotSchemaDesigner")._tableTreeObj._liList;
// To change the field caption in field list button.
for (var i = 0; i < fieldMembers.length; i++) {
if (fieldMembers[i].name == "Quantity") {
fieldMembers[i].caption = "Qty";
fieldMembers[i].format = "currency";
}
}
// To change the field caption in field list treeview.
for (var i = 0; i < treeviewList.length; i++) {
if (treeviewList[i].querySelector('.e-text').innerText == "Quantity") {
treeviewList[i].querySelector('.e-text').innerText = "Qty";
}
}
} |