Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

How to move the workcenter subtotal to type

Answered
Zander asked on November 26, 2020

How to display the “workcenter total” position to the “type” position with the value unchanged

1 answer

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster November 26, 2020

Hello, Zander,
 
Thank you for reaching out to us.
 
If we understand correctly, you require to move the “workcenter total” caption one cell to the right.
It is achievable using the customizeCell hook provided by Flexmonster. This API call allows customizing separate cells.
 
We prepared the JSFiddle to demonstrate this approach: https://jsfiddle.net/flexmonster/8L31un65/.
Our team would like to provide some additional explanation about the following code snippet used in the example:

flexmonster.customizeCell((cell, data) => {
  if (data.type == "header" && data.isClassicTotalRow && data.hierarchy) { //filter out unnecessary cells
    switch (data.hierarchy.uniqueName) {
      case "Category": //clear current cell if it belongs to "Category" field
        cell.text = "";
        break;
      case "Color": //replace content of the current cell if it belongs to "Color" field
        cell.text = flexmonster.getCell(data.rowIndex, data.columnIndex - 1).escapedLabel; //text of the current cell is replaced with text of the left neighbor.
        break;
    }
  }
});

 
We want to notice that this approach only works for static configurations. It may lead to unexpected results after the configuration is changed.
Please consider complementing the sample code to match the required set of configurations.
 
Please let us know if it works for you.
Feel free to contact us in case other questions arise.
 
Regards,
Illia

Please login or Register to Submit Answer