☝️Small business or a startup? See if you qualify for our special offer.
+

remove collapse arrow

Re-Open
Fabrizio asked on April 11, 2025

Hello,

I'd like to ask if it's possible to remove the default arrow/collapse functionality that compacts months to show only the year in the Flexmonster component.

Currently, when using a date hierarchy in our reports, there's a default arrow that allows users to collapse all months to display just the year. For our specific implementation, we'd prefer to disable this feature and always show the full date hierarchy without the collapse option.

Is there a configuration property or setting that would allow us to remove or disable these collapsing arrows? If so, could you please provide guidance on how to implement this, along with any code examples if available?

Thank you in advance for your assistance.

 

Kind regards, Fabrizio

16 answers

Public
Fabrizio April 11, 2025

sorry, the attachment

Attachments:
Cattura.PNG

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 11, 2025

Hello Fabrizio,

Thank you for reaching out to us.

We recommend using the customizeCell function to remove the collapse/expand arrows from the grid. The idea is to remove the expand icon from the cell and prevent the cell from clicking. You are welcome to check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/xb86haov/

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Fabrizio April 15, 2025

Thank you Nadia, it's all ok!

Fabrizio

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 15, 2025

Hello Fabrizio,

Thank you for the feedback!

Do not hesitate to contact us if other questions arise.

Kind regards,
Nadia

Public
Fabrizio April 22, 2025

Dear Nadia,

I hope this email finds you well. I'm writing regarding ticket about the pivot table functionality.

As shown in this video https://dev.goprofit.cloud/upload/2025-04-22_09h45_27.mp4 , there's still a minor issue with the grouping functionality. Even though we've made progress, there appears to be a problem with how the data is being aggregated when grouped.

Additionally, I have a question about implementing a specific calculation feature.

Currently, when I select a value from the dropdown, the pivot table reloads with data calculated by dividing one value by another. However, for the grouping phase, we need to implement a weighted average field.

To be clear, I'm not looking for a simple average of the displayed values, but rather a weighted average calculated as:

  • Sum of all values ÷ Sum of all divisors

Do you have any suggestions on how we might implement this weighted average calculation in the pivot table? This would greatly enhance the analytical capabilities of our report.

Thank you for your continued support on this project. I look forward to your insights.

 

Best regards,

Fabrizio

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 23, 2025

Hello Fabrizio,

Thank you for the feedback!

Currently, Flexmonster does not allow complete disabling of the expand functionality. However, you can disable the pointing cursor using the CCS rules: pointer-events: none;.

To achieve a weighted average instead of a built-in average aggregation, we recommend creating calculated values. You are welcome to check our documentation for more details: https://www.flexmonster.com/doc/calculated-values/

Feel free to check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/0tw5f3xh/

Please let us know if any questions arise.

Kind regards,
Nadia

Public
Fabrizio April 29, 2025

Here's your email translated from Italian to English:

Hello Nadia,

Thank you for your support. Unfortunately, I cannot find a way to apply the CSS, but I would say that this is not the right approach anyway since I need to display the weighted average in the case of collapse.

Unfortunately, the application of Flexmonster to our project has become, in my experience, quite complex, and I cannot achieve the desired result.

Does Flexmonster possibly provide personalized consulting on a specific client project? Obviously with paid support. If so, what are the procedures?

 

Thank you

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 30, 2025

Hello Fabrizio,

Thank you so much for your feedback.

Although we don’t provide personalized consulting services for individual projects, our Tech team is always happy to assist you with detailed documentation, tailored recommendations, and relevant examples based on your needs. If you share your desired results, we will do our best to suggest ways to achieve them. We hope our guidance will help your team in the implementation process.

Our team would like more details about your use case. The first request was to remove the collapse arrow to restrict the display of only the Year field, so that the Month field is always expanded. We have prepared an example illustrating removing the collapse arrow: https://jsfiddle.net/flexmonster/gvuexy0o/. The CSS rules from the previous answer are used to prevent the cursor from changing when hovering on the cell with the expand button.

It is also possible to enable a read-only mode. In the read-only mode, you cannot interact with the report via UI (e.g., the context menu, expands, and drills are disabled). For example:

report: {
// other properies
options: {
readOnly: true
}
}

Please check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/w2e6srz9/.

Regarding your question about “displaying the weighted average in the case of collapse,” could you please clarify what you mean by that? If we understood correctly, you only want to see expanded data (with the Month field), not collapsed. Additionally, it would be very helpful if you could share an example of how you intend to calculate the weighted average using your data.

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Fabrizio May 6, 2025

Thank you, Nadia. Unfortunately, I wasn't able to apply the example. I'll take a few days to create a static page with HTML and JavaScript, and then I'll ask for your help in applying the weighted average code. Thank you.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 6, 2025

Hello Fabrizio,

Thank you for the reply.

We will be looking forward to hearing from you.

Kind regards,
Nadia

Public
Fabrizio 6 hours ago

Hi Nadia, I'm back

The system shows for each row the results for example of how much a hotel spent for example for drinks or for any other purchase. The rows, through G1 G2 G3 ... are grouped by successive categories.

For column we have the period Year/month.

Now I'll try to explain to you what is there and what I would like to obtain. In particular I would like that in case of DividiPerDato<>0 the row total disappears and the weighted average appears.

 

this is a portion of the JSON data loaded into the variable returned by getData:

 

[

    {

        "G1": "Reddito Netto",

        "G2": " EBITDA",

        "G3": "Profitto Operativo Lordo (GOP)",

        "G4": " Profitto dei Reparti Operativi",

        "G5": "Costi Operativi",

        "G6": " Camere",

        "Anno": "2025",

        "Mese": "Gennaio",

        "Valori": -12.168589872973305,

        "Livello": "L.5",

        "G7": "",

        "Link": "L.5 -7\/11",

        "G8": "",

        "G9": "",

        "G10": "",

        "G11": ""

    },

    {

        "G1": "Reddito Netto",

        "G2": " EBITDA",

        "G3": "Profitto Operativo Lordo (GOP)",

        "G4": " Profitto dei Reparti Operativi",

        "G5": "Costi Operativi",

        "G6": " Camere",

        "Anno": "2025",

        "Mese": "Febbraio",

        "Valori": 0,

        "Livello": "L.5",

        "G7": "",

        "Link": "L.5 -7\/11",

        "G8": "",

        "G9": "",

        "G10": "",

        "G11": ""

    },

 

...

 

As you can see, "Valori" contains the number to be shown in the Flexmonster pivot. It’s defined like this:

 

{

    "uniqueName": "[Measures]"

}

],

"measures": [{

    "uniqueName": "Valori",

    "aggregation": "sum",

    "format": "percformato"

}

 

What I actually need is:

 

When var DividiPerDato = 0, I want to keep using the same formula: "aggregation": "sum".

 

But when var DividiPerDato !== 0, I need to pass a new field that is the divisor, allowing me to:

 

Assuming I have:

var1 = 10, var2 = 20, divider1 = 100, divider2 = 100

Then I want to display:

res1 = var1 / divider1

res2 = var2 / divider2

These should be summed within the individual pivot cells.

 

The total weighted average, however, should be:

(res1 + res2) / (the divider for Year-Month, taken only once per month).

For the same Year-Month column, the divisor is always the same (e.g. 100 for January 2025, 200 for February 2025…).

 

I hope I make myself clear, it is difficult to explain.

Attached you will find the flexmonster.js used for the pivot.

 

Thanks

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster 6 hours ago

Hello Fabrizio,

Thank you for getting back to us.

It seems that the flexmonster.js file was not attached. Could you please resend it?

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Fabrizio 6 hours ago

try this

Public
Fabrizio 6 hours ago

zip file in attachment, thanks

Attachments:
flexmonster.zip

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster 40 mins ago

Hello Fabrizio,

Thank you for the provided code.

We recommend using the following approach:

1) Use the DividiPerDato value to create the measure to display on the grid based on the DividiPerDato value. If DividiPerDato === 0, the sum value of the "Valori" field will be shown, otherwise, the "Weighted Average" formula will be calculated. Please note that the divisor field should be added to your data source. For example:

var DividiPerDato = 1;
var measureValori = {};
if (DividiPerDato === 0) {
measureValori = {
uniqueName: "Valori",
aggregation: "sum",
}
} else {
measureValori = {
caption: "Weighted Average",
uniqueName: "weighted_avg",
formula: "sum('Valori') / sum('Divisor')",
}
}

2) Add the measure created based on DividiPerDato value to the slice.measures array:

slice: {
// rows and columns configs,
measures: [measureValori],
},

We have prepared the following JSFiddle for illustration: https://jsfiddle.net/flexmonster/7c1agm06/.

Please let us know if this approach works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Fabrizio 29 mins ago

Perfect, the DividiPerDato variable is dynamically changed by a select in the page. Can I define the "measureValori" variable dynamically? Finally, if the Year is not collapsed I need to show the total of the values ​​while if it is collapsed I need to show the weighted average.

Please login or Register to Submit Answer