We have updated WebDataRocks EULA, effective as of April 18, 2024. Learn more about what's changed.

Hide subtotal on some row.

Answered

Hi,
Have to say that, this tool is great. 
I need help with not showing the subtotal for some of the rows.
As shown in the picture I don’t need to see the subtotal on the highlighted row data.
I only want to see the subtotal of the first row item only.
 
 
var pivot = new WebDataRocks({
container: “#wdr-component”,
toolbar: true,
height: “700”,
customizeCell: customizeCellFunction,
report: {
“dataSource”: {
“dataSourceType”: “json”,
// “browseForFile”: true
“filename”: “periods.json”
},
“slice”: {
“expands”: {
“expandAll”: true
},
“rows”: [
{
“uniqueName”: “plinid”,
“caption”: “Category”
},
{
“uniqueName”: “itmclss”,
“caption”: “Mfr”
},
{
“uniqueName”: “item”,
“caption”: “Part Number”
},
{
“uniqueName”: “itmdesc”,
“caption”: “Description”
},
{
“uniqueName”: “avgcost”,
“caption”: “Avg Cost”
}
],
“columns”: [
{
“uniqueName”: “aging_period”
},
{
“uniqueName”: “Measures”
}
],
“measures”: [
{
“uniqueName”: “aging_qty”,
“aggregation”: “sum”,
“caption”: “Qty”
},
{
“uniqueName”: “aging_amt”,
“aggregation”: “sum”,
“format”: “3n0prh14”,
“caption”: “Amt”
}
]
},
“options”: {
“grid”: {
“type”: “classic”
}
},
“formats”: [
{
“name”: “3n0prh14”,
“thousandsSeparator”: “,”,
“decimalSeparator”: “.”,
“currencySymbol”: “$”,
“currencySymbolAlign”: “left”,
“nullValue”: “”,
“textAlign”: “right”,
“isPercent”: false
}
],
“tableSizes”: {
“columns”: [
{
“idx”: 3,
“width”: 360
}
]
}
},
reportcomplete: function() {
pivot.off(“reportcomplete”);
pivotTableReportComplete = true;
// createGoogleChart();
}
});
function customizeCellFunction(cellBuilder, cellData) {

if (cellData.type == “header”) {
switch(cellData.columnIndex) {
case 1:
case 2:
case 3:
case 4:
cellData.isTotalRow = false;
console.log(cellData);
}
}
}
 
 

Thanks a lot.

Attachments:
Capture.JPG

3 answers

WebDataRocks Team WebDataRocks August 27, 2019

Hello Akhilesh VK,
 
Thank you for the details.
Please take a look at the "showTotals": "off" property: https://codepen.io/webdatarocks/pen/yLBbJGo
Does it work for you?
 
Regards,
WebDataRocks Team

Akhilesh VK August 27, 2019

Hi Team,
Thanks for getting back to me.
Sorry to say, but this didn’t gave me what I really want. Please see the attachment.
Thanks for your help.

Attachments:
wdr.jpg

WebDataRocks Team WebDataRocks September 3, 2019

Hello Akhilesh VK,
Thank you for your feedback.
 
Currently, it is possible either to enable totals for all the levels or to disable them for all the levels.
As a workaround, you can try customizeCell approach: https://www.webdatarocks.com/doc/customizecell/. It allows changing cell content dynamically.
 
Regards,
WebDataRocks Team