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

Context menu to open from cell click

Answered
Manoj asked on July 6, 2020

Good day Team,
My requirement is, On Pivot Grid open context menu from click on cell instead of right click on the cell.
Can you please assist with me this.
 
Your help is Appreciated.
Thanks,
Manoj.

1 answer

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster July 6, 2020

Hello,
 
Thank you for reaching out to us.
 
Our team would like to kindly explain that invocation of the built-in context menu can not be bound to another event.
 
Even so, it is possible to implement the custom context menu and open it on the desired event (for example, left click).
 
We suggest following steps below in order to implement the desired functionality:
1. Disable the built-in context menu appearing on the right click on the cell. It is achievable using the following code snippet:

flexmonster.customizeContextMenu(function(items, data, viewType) {
  return [];
});

2. Next, subscribe to the cellclick event which is triggered every time a cell is clicked on the grid. The Cell Data Object of the clicked cell returned to the handler. It contains detailed information about the cell, including its position on the grid.
3. Every time the mentioned event is triggered, create a custom context menu based on the information returned to the handler. It can be rendered nearby the clicked cell using coordinates received with a Cell Data Object.
 
We hope it works for you.
Please let us know if other questions arise.
 
Regards,
Illia

Please login or Register to Submit Answer