How to enable/disable "Disable Inline Edit" in entity manager

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • murugappan
    Active Community Member
    • Aug 2017
    • 467

    How to enable/disable "Disable Inline Edit" in entity manager

    Hi,

    How to we disable or enable the "Disable Inline Edit" option in entity manager for a field based on a value in another field. This is similar to the "required" and "display" conditions. Eg. We want disable inline edit for "Status" field if the "Claim Type" field's value is "Admission". For all other Claim Types we want to enable inline edit.

    We face some cumbersome problems when we allow inline edit for all fields as staff intentionally or lazily skip updating related fields.

    Appreciate any help (all the help).

    Tq.


    *************************** COVID-99 Advsory *******************************************
    In Malaysia, we have achieved single digit new cases and zero deaths per day for
    last one month. Of the 8,600 infections we have only 600 cases left for treatment
    and remainder have all gone home!! You can do it too. Listen to your government!!!
    ************************ Stay Free and Stay Safe *****************************************


  • yuri
    Member
    • Mar 2014
    • 8444

    #2
    Hi,

    There is no functionality to disable/enable inline edit. It should be possible somehow with some tricks but I never tried. I always resorted to setting it disabled permanently for such situations.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • telecastg
      Active Community Member
      • Jun 2018
      • 907

      #3
      Hi murugappan,

      The latest release of the enhanced-dynamic-logic plug in includes the ability to enable or disable inline edit for any field easily through the use of the custom enhanced-dynamic-handler class like this:

      Background:

      - We have a "Collection Issue" entity which contains fields "pastDueRent" and "lateFee"
      - We want "lateFee" to be enabled for inline editing only when "pastDueRent" is higher than $100

      Step 1: Download and install the enhanced-dynamic-logic plugin https://github.com/telecastg/enhance...ic-for-espocrm

      Step 2: Create script client/custom/src/collection-issue-dynamic-handler.js
      Code:
      define('custom:collection-issue-dynamic-handler', ['enhanced-dynamic-logic:enhanced-dynamic-handler'], function (Dep) {
      
          return Dep.extend({
      
              init: function () {
                  this.controlFields();
      
                  // invoke controlFields method every time pastDueRent changes
                  this.recordView.listenTo(
                      this.model, 'change:pastDueRent', this.controlFields.bind(this)
                  );
              },
      
              controlFields: function () {
                  if (this.model.get('pastDueRent') > 100) {
                      this.setFieldInlineEditEnabled('lateFee');
                  } else {
                      this.setFieldInlineEditDisabled('lateFee');
                  }
              }
      
          });
      });
      Step 3: Modify the custom clientDefs metadata file for Collection Issue to let Espo know that the custom dynamic-handler class needs to be invoked when setting up the entity detail display
      custom/Espo/Custom/Resources/metadata/clientDefs/CollectionIssue.json
      Code:
          "dynamicHandler": "custom:collection-issue-dynamic-handler",
      Step 4: clear cache and rebuild.

      Best Regards
      Last edited by telecastg; 06-23-2020, 04:44 AM. Reason: Added Step 4

      Comment

      • murugappan
        Active Community Member
        • Aug 2017
        • 467

        #4
        Hi telecastg,

        Thank you so much for the help. I will try soon.

        Comment

        Working...