Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Howdy,
I am using a server instance of Confluence and am trying to prevent users from dragging the filter fields in the Table Filter macro.
I've added the following script on the page:
<!-- Prevent dragging filter fields -->
<script type "text/javascript">
$(document).ready(function() {
var tblFilter = $('.tableFilterCbStyle');
tblFilter.find('.sortable').removeClass('sortable');
// Seems like the .draggable class is no longer available in the plug-in
// tblFilter.find('.draggable').removeClass('draggable');
});
</script>
Indeed, when I hover mouse over the borders of filter fields, the mouse pointer no longer changes to the cross, indicating the field can be dragged. As such, I suppose the fields can not be dragged now.
However.
I can click and hold the field label and then drag it over the filter block. Sure, I cannot change the position of each field like I did so before, but I still can drag the fields.
If drag the field all the way out the filter block and then drop the dragged field, field gets removed from the filter. This is unwanted behavior as it poses a rick for the users to inadvertently remove filter fields.
How do I avoid this behavior and prevent the users from dragging and dropping the fields?
Thank you.
Stan
Hi Stan,
Please, try to add this js:
tblFilter.find('.sortable-container').removeClass('sortable-container').sortable({disabled: true});
Hi Andrey,
Thanks for the response! Works flawless.
Just needed to add this
tblFilter.find('.filter-container, .filter-container .hideble').css('cursor','default');
to prevent the mouse pointer from changing to the cross-pointer when clicking the label.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Can someone guide me where to add this script as I am facing the same challenege.
Thanks
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.