🍉 Meet Flexmonster Pivot Table & Charts 2.9.Check out all the hot features!
Get Free Trial

How to prevent filters and columns, rows headers from dragging

Devesh asked on August 7, 2019

Hi team,
I want to freeze the drag able headers and prevent user to drag them. I can do it with css using pointer events but I have different report configs in same component (lets say report1 and report2)and I want to prevent dragging for report2 only, so How can I do this with tool options?
e.g. ‘Salesperson’ and ‘Category’ fields are draggble by default but i want to prevent them.

2 answers

Vera Didenko Vera Didenko Flexmonster August 8, 2019

Thank you for your question.
The dragging option can be disabled by specifying the dragging parameter in the options object:

options: {
grid: {
dragging: false

Here is a JSFiddle example for illustration.
We would like to mention that moving fields to other sections on the grid ( for example, to rows, columns, …) is also available through the right-click context menu.
The context menu can be customized via the customizeContextMenu API call.
Please see our customizing context menu tutorial for guidance.
For example, the following will remove all context menu items:

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

Here is a JSFiddle example for illustration.
Please let us know if everything works.
Best Regards,

Devesh August 8, 2019

Thanks Vera!
It works.

Please login or Register to Submit Answer