How to disable right-click on editable list view rows

  • 15 February 2022
  • 0 replies
  • 21 views

Badge +5

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.
    23288iD77E2FC7F99BF40D.png
  2. Under the rule, "When the view executed initialize", add a Transfer Data action to the Data Label control.
    23289i18F417EBB5AB816F.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
      23301iC23C174C3B73EE49.png
    2. Transfer data: pass the same script above to the Data Label control
      23289i18F417EBB5AB816F.png

0 replies

Be the first to reply!

Reply