$("#sales").dxPivotGrid({
allowSorting: true,
showColumnTotals: false,
showColumnGrandTotals: false,
showRowGrandTotals: false,
showRowTotals: false,
allowFiltering: true,
height: 440,
showBorders: true,
fieldChooser: {
enabled: false
},
"export": {
enabled: true,
fileName: "Sales"
},
dataSource: {
fields: [{
caption: "subject",
width: 120,
dataField: "subject",
area: "row"
}, {
caption: "studentname",
dataField: "studentname",
width: 150,
area: "column",
}, {
caption: "PassingMarks",
dataField: "PassingMarks",
dataType: "number",
summaryType: "sum",
area: "data"
}, {
caption: "ActualMarks",
dataField: "ActualMarks",
dataType: "number",
summaryType: "sum",
area: "data"
}, {
caption: "Comments",
area: "data",
calculateSummaryValue: function(e) {
if (e.value("PassingMarks") < e.value("ActualMarks")) {
return "Pass";
} else {
return "fail";
}
}
}],
store: sales
}
});
我正在使用devextreme pivot grid显示学生姓名明智(列)。我希望根据相邻单元格PassingMarks,ActualMarks,使用calculateSummaryValue()
在“评论”列中返回字符串单元格值。任何帮助将不胜感激。
答案 0 :(得分:0)
尝试一下,
caption: "Comments", isMeasure: true, calculateSummaryValue: function (e) {
if (e.value("PassingMarks") < e.value("ActualMarks")) {
return "Pass";
} else {
return "fail";
}
}