Option to disable double click to edit when Mode is set to Read with Inline-Editing

Pat VachonPat Vachon Member ✭✭
edited June 25 in Ideas
I have a use case that needs this functionality.

Is there a way to disable this via js?
1
1 votes

Awaiting Review · Last Updated

Comments

  • John DahlbergJohn Dahlberg Member
    edited June 25
    Use this as a snippet field renderer.  Note that this doesn't handle hiding the pencil icon on hover, but this is the logic to prevent the field from entering into edit mode on a double click.  With this method, If you add an edit button and use the declarative action to run a component action it will still open up edit access on the field.  Setting the field to read-only will disable the component action from opening edit access altogether.



    var field = arguments[0],    
        value = arguments[1],
        cellElem = field.element;
        $ = skuid.$;
        function noclick(evt){
            console.log(evt);
            evt.preventDefault();
            return false;
        }
    skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
    cellElem.on('dblclick',noclick);
  • John DahlbergJohn Dahlberg Member
    edited July 2018
    Also, a declarative option would be to add two copies of the field to the field editor / table and use rendering logic to toggle between them.  You can setup a ui-only field to track your mode selection for the rendering logic.  Then say in an edit button, you would change the mode of the ui field to switch which field is displayed.  
  • Pat VachonPat Vachon Member ✭✭
    edited July 2018
    Hmmm ... I'd like for this to be a universal thing for all fields on the page. Setting each field to use this would be impractical.

    I have a global field renderer code that I'll extend with this.
  • John DahlbergJohn Dahlberg Member
    edited July 2018
    I'd love to see that solution.
  • Pat VachonPat Vachon Member ✭✭
    edited July 2018
    Me too. ;)
  • Pat VachonPat Vachon Member ✭✭
    edited August 2018
    Got it working with one minor change.

    evt.stopImmediatePropagation();
    instead of
    evt.preventDefault();

    Here's the globalFieldRenderer code.
Sign In or Register to comment.