Announcement

Collapse
No announcement yet.

Custom Jquery in detail view, where to add?

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

  • Custom Jquery in detail view, where to add?

    I would like to be able to collapse the panels by doubleclicking on the heading.

    Where would you add this customisation for the detail view of any entity?

    Code:
    $('.panel-heading').each(function(){
        $(this).dblclick(function() {
            console.log("toggle panel");
            $(this).siblings().toggleClass("collapse");
        });
    });
    Thank you,


  • #2
    Ok, without SPA logic, you can use this:

    create file client.json in /custom/Espo/Custom/Resources/metadata/app/

    Code:
     {    
    "scriptList": [        
    "__APPEND__" ,      
    "client/custom/js/foldpanels.js"
        ],
    
    "developerModeScriptList": [      
     "__APPEND__"  ,    
    "path/to/your/js/file.js"    ]
    }
    create file foldpanels.js in /client/custom/js/

    Code:
    $(document).on("dblclick", ".panel-heading", function() {
                $(this).siblings().toggleClass("collapse");
    });
    Since the jquery on() function monitors $(document) for changes, this will even work after SPA rendering.
    Using $('.panel-heading') would not work here.
    Last edited by rinorway; 04-25-2019, 07:21 AM.

    Comment


    • telecastg
      telecastg commented
      Editing a comment
      Thanks for posting the solution too, makes this forum a lot more useful !
Working...
X