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.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I prevent users from dragging fields in the Table Filter macro

Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2018 edited

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
 

1 answer

1 accepted

0 votes
Answer accepted
Andrey Khaneev [StiltSoft]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 12, 2018

Hi Stan,

Please, try to add this js:

tblFilter.find('.sortable-container').removeClass('sortable-container').sortable({disabled: true});
Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2018

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.

abhishek_gupta August 30, 2023

Hi 

 

Can someone guide me where to add this script as I am facing the same challenege.

Thanks
Abhishek

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Upcoming Confluence Events