No ratings

How to disable right-click on editable list view rows

Topic

If there is a need to prevent users from right-clicking on editable list view rows, you can use jQuery to achieve this.

Instructions

  1. Add a Data Label control to your view. Make sure to enable the Literal property and disable the Prevent XSS property.
    DataLabelProp.PNG
  2. Under the rule, "When the view executed initialize", add a Transfer Data action to the Data Label control.
    TransferDataDL.png
  3. Map this script to the Data Label control under this action:
    <script type="text/javascript">
    $(document).ready(function() {
    $("tr").on("contextmenu",function(){
    return false;
    });
    });
    </script>​
  4. If users have the option to refresh the list view, then the script might stop functioning. To avoid this, you will need to add or edit, if existing, this rule: "When the View executed List refresh".
  5. Under this rule, add in the following actions, in order:
    1. Transfer data: pass an empty value to the Data Label control
      TransferDataEmpty.PNG
    2. Transfer data: pass the same script above to the Data Label control
      TransferDataDL.png
Labels: (2)
Version history
Last update:
a month ago
Updated by:
Contributors