Announcement

Collapse
No announcement yet.

Report Template Custom CSS

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

  • Report Template Custom CSS

    Is there a nice way to add custom CSS to a report template, either via a high-priority custom.css file or other?

    When adding inline CSS via the "style" attribute, most of the custom entries are ignored.

  • #2
    Is there anything which can be done which would survive updates?

    Comment


    • #3
      Anybody?

      Comment


      • #4
        Custom css files can be incorporated by:

        a) Adding <link> elements within the template (see "client/modules/crm/res/templates/calendar/calendar.tpl" )
        b) Loading on start up (check this tread: https://forum.espocrm.com/forum/deve...ication-starts )

        Loading files by modifying a standard template will not survive upgrades, loading files on start up would survive upgrades but you still need to apply the new classes defined within the template, so either way you need to create a custom template.

        Not sure how to do it for Report but for a regular entity like "Contact" this is what I would do to change the detail record display:

        1) Create a custom template file ("client/custom/res/templates/my-custom-detail-template.tpl"), copying the original content from "client/res/templates/record/detail/tpl" which is the default detail template for entities and modifying it as required.

        2) Create a custom clientDefs json file ("custom/Espo/Custom/Resources/metadata/clientDefs/Contact.json") and write:
        Code:
         "recordViews": {
             "detail": "custom:views/my-custom-contact-view"
         }
        3) Create custom view file ("client/custom/scr/views/my-custom-contact-view.js") and write:
        Code:
        Espo.define('custom:views/my-custom-contact-view', 'views/record/detail', function (Dep) {
        
            return Dep.extend({
        
                template: ''custom:my-custom-detail-template''
            });
        
        });
        Hope this helps

        Comment

        Working...
        X