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

How to block drill-through viewing for a specific cell

Re-Open
leandro f asked 4 days ago

Hello,
I would like to know how to block drill-through viewing when double-clicking on a specific cell.

 

I understand that setting the "drillThrough: false" option disables the functionality for all cells, but I need to block only specific cells.

4 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster 1 day ago

Hello,

Thank you for contacting us.

Currently, it is only possible to enable or disable the drill-through view for all the cells simultaneously using the drillThrough option. Alternatively, you can set the drillThrough property to false and use the celldoubleclick event to implement your custom drill-through feature. Please check our documentation for more details: https://www.flexmonster.com/api/celldoubleclick/.

You are welcome to contact us if other questions arise.

Kind regards,
Nadia

Public
leandro f 1 day ago

Hello,

Thanks for the explanation.

Today we don't want to create a different drill-through view, we would just like to block the functionality for specific cells. We tried returning false in the celldoubleclick callback and were unsuccessful.

Is it possible for you to add a functionality to prevent the drill-through view modal from opening? Maybe pass the mouseEvent as the second argument, this way we could call event.preventDefault() when necessary.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster about 1 hour ago

Hello,

Thank you for the feedback.

Currently, there are no plans to add the functionality to prevent showing the drill-through view for the specific cells. However, you can use the following workaround:

You can create a function to check the cell properties and add the CSS styles to hide the pop-up window. For example:

function customDrillThrough(cell) {
if (
cell &&
cell.rows[0] &&
cell.rows[0].uniqueName &&
cell.rows[0].uniqueName == "status.[inactive]"
) {
document.querySelector(".fm-drillthrough-view").style.display = "none"
document
.querySelectorAll(".fm-ui-modal-overlay")
.forEach((element) => (element.style.display = "none"))
}
}

Additionally, it is necessary to remove the "Drill Through" option from the context menu for those cells:

function customizeContextMenuFunction(items, data, viewType) {
if (
data.rows[0] &&
data.rows[0].uniqueName &&
data.rows[0].uniqueName == "status.[inactive]"
) {
items = items.filter(function (item) {
return item.label !== "Drill through"
})
}
return items
}

Then, add the created functions to the Flexmonster constructor:

const pivot = new Flexmonster({
// other properties
customizeContextMenu: customizeContextMenuFunction,
celldoubleclick: customDrillThrough,
})

In the following JSFiddle, the drill-through functionality is disabled for the "Inactive" value: https://jsfiddle.net/flexmonster/dv41s3hr/.

We hope it helps. You are welcome to contact us if other questions arise.

Kind regards,
Nadia

Public
leandro f 24 mins ago

Hi Nadia,
thanks for your reply.

I saw this solution in another thread, but I noticed through your fiddle that the modal is displayed and then quickly hidden, giving the impression of a bug, don't you think?

I think a native functionality to avoid opening this modal would be of great value.

Please login or Register to Submit Answer