Add a button/drop-down menu in the dimension column header of the pivot table

Answered
Josh asked on July 13, 2022

Hello,
The ability to sort columns in the pivot table exists for measure columns, but how about dimension columns?
Furthermore, is it possible to customize the dimension column header to display a button which uses a drop-down menu?
I'll attach a file for example.
 
As a separate, but simpler question: how do I add tooltip for pivot table cell data? I was only able to find it for column header cells:
Tooltip for Pivot column width (found it for header)
https://www.flexmonster.com/question/tooltips-on-header-of-the-kpis/

Attachments:
hamburger menu.png

4 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 13, 2022

Hello, Josh!
 
Thank you for reaching out to us and providing us with the attachments.
 
Please find the detailed answers to your questions below:
 
1. The ability to sort columns in the pivot table exists for measure columns, but how about dimension columns?
Members in Flexmonster can be sorted from the UI and via the report.

To sort members from the UI:

  1. Open the filter pop-up for the member by clicking on the corresponding header
  2. Select the desired sorting in the right upper corner. It can be either A-Z or Z-A.

 
2. Is it possible to customize the dimension column header to display a button which uses a drop-down menu?
We kindly suggest using the context menu combined with the setSort() API call to achieve the desired behavior. 
Here is a short guide on how to implement it:

  1. Use the customizeContextMenu() API call, which will iterate over all cells.
  2. Select the necessary cell using the information from the data parameter of the customizeFunction.
  3. Add a new item to the context menu and specify the action in the item's handler using setSort as follows:
{
          label: "sort in Ascending order",
          handler: function() {
            flexmonster.setSort(data.hierarchy.uniqueName, "asc");
          }
}

We have prepared a JSFiddle example: https://jsfiddle.net/flexmonster/f5m348vc/. Right-click any hierarchy name(Color or Country) to see the result.
 
For more details about customizing the context menu, please visit our docs: https://www.flexmonster.com/doc/customizing-context-menu/.
We kindly provide the article about the setSort API call as well: https://www.flexmonster.com/api/setsort/.
 
3. How do I add a tooltip for pivot table cell data? 
Kindly note that tooltips can be added only to the headers. We suggest considering a context menu approach as a workaround.
 
Hope you will find this answer helpful.
 
Regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 20, 2022

Hello, Josh!

Hope you are doing well.

Our team is wondering if you had some time to look through our recommendations. Could you please let us know if our answer was helpful?

Looking forward to hearing from you.

Regards,
Solomiia

Public
Josh July 20, 2022

Yes, #1 and #2 works. I was able to customize the context menu i.e. right-click options to include sort for the dimension headers. #3 did not match the UX design so we passed on it.

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 21, 2022

Hello, Josh!

Thank you for your feedback.

We are glad to hear that our suggested approaches work for you.

Feel free to contact us if any other questions arise.

Best regards,
Solomiia

Please login or Register to Submit Answer