Announcement

Collapse
No announcement yet.

Conditional View/Hide

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditional View/Hide

    tanya
    ​​​​​​​I want to hide/show panel into my detail view for a module based on a drop-down's value.
    So how I can make it?

  • #2
    I tried to edit this file as follows:
    sudo vim client/custom/src/views/AccountOpening/detail.js


    Code:
    console.log(currentModel.model.attributes.accountT ype);
    var accountType = currentModel.model.attributes.accountType;
    console.log(accountType);
    if(accountType == "Retail/Staff" || accountType == "Retail"){
    $('h4:contains("Institutions")').parent().parent() .hide();
    } else if (accountType == "Institution"){
    $('h4:contains("Retail/Staff")').parent().parent().hide();
    }

    and called this code into the auttoRender method, but I wanted it to run before the page load.
    Can you tanya help me

    and I want to know also how to make a "Change log" on every detail view record for modules with all fields changes.
    Last edited by DevMostafa; 11-08-2017, 03:48 PM.

    Comment


    • #3
      Hello
      much easier way https://www.espocrm.com/documentatio...dynamic-forms/

      Comment


      • DevMostafa
        DevMostafa commented
        Editing a comment
        Thanks for your fast response and I'll try it.
        Regarding the other question:
        I want to know also how to make a "Change log" on every detail view record for modules with all fields changes.

    • #4
      If entity has Stream and fields are audited, you will see change log in stream

      Comment


      • #5
        tanya I have made my file "custom/Espo/Custom/Resources/metadata/clientDefs/AccountOpening.json" like this:


        Code:
        {
        "controller": "custom:controllers/AccountOpening",
        "views": {
        "detail": "custom:views/AccountOpening/detail",
        "edit": "views/edit"
        
        },
        "recordViews": {
        "detail": "custom:views/AccountOpening/record/detail"
        },
        "boolFilterList": [
        "onlyMy"
        ],
        "formDependency": {
        "accountType": {
        "map": {
        "Institution" : [
        {
        "action": "show",
        "panels": ["Institutions"]
        }
        ]
        },
        "default": [
        {
        "action": "hide",
        "panels": ["Institutions"]
        }
        ]
        }
        }
        }
        and still the panel showed even if the condition not applied.

        Comment


        • #6
          tanya

          Sorry the problem has been solved, but with the new following scenario:
          I have made it from the UI on my version 4.8.2 from each field definition which write it to the .json file as follows



          Code:
          "dynamicLogic": {
                  "fields": {
                      "institutionAndGovernmental": {
                          "visible": {
                              "conditionGroup": [
                                  {
                                      "type": "equals",
                                      "attribute": "accountType",
                                      "value": "Institution"
                                  }
                              ]
                          }
                      },
                      "institutionMissingLog": {
                          "visible": {
                              "conditionGroup": [
                                  {
                                      "type": "equals",
                                      "attribute": "accountType",
                                      "value": "Institution"
                                  }
                              ]
                          }
                      },
                      "institutionalClients": {
                          "visible": {
                              "conditionGroup": [
                                  {
                                      "type": "equals",
          Can I replace "fields" with "panels" as on the documentation
          wmoghes Please follow up with this
          Last edited by DevMostafa; 11-12-2017, 03:00 PM.

          Comment

          Working...
          X