Hook into refresh action of report result view

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robin
    Junior Member
    • Aug 2025
    • 13

    #1

    Hook into refresh action of report result view

    Hello,

    I've got the following situation: I've developed a little extension, which lets me set the width of a table in the list-view of a report. The reason is, that I got a report with plenty of columns, but even in the result-view the columns would be super squished, so nothing useful can be read in the report. The solution was to tinker with the css of the report table to allow the table to be a lot wider while the extra columns on the right can be viewed when scrolling with a horizontal scrollbar. This solution works so far, however I now face the following problem:
    I apply the new css via a custom detail and result view (so one for the small table in the report detail view and one for the result-view) where I overwrite the afterRender method. In this overwritten afterRender method I apply the css. However when I refresh the data via the refresh button, the table gets rerendered without triggering my modified afterRender function (which in turn resets my custom css) .
    That itself wouldn't be a big issue, since iIusers to just refresh the page instead of using the refresh button. However when I sort the columns, the table also gets rerendered without triggering my afterRender. And here I cant just reload the entire page, since that would reset the sort of the columns.

    I've now tried to also overwrite the refresh-function and apply my custom css there, with no success however. Upon inspecting the code in module-advanced.js a bit closer I figured out, that the refresh function is part of the view "advanced:views/report/reports/base" (so the base view).
    I've tried overwriting the baseview in the same manner as I overwritten the detail and result view with my customview, but without any success:
    Click image for larger version

Name:	image.png
Views:	0
Size:	16.1 KB
ID:	125518

    it seems the baseview is not meant to be overwritten.

    I also tried my luck by trying a viewSetupHandler to execute my customcode through that, but according to the documentation https://docs.espocrm.com/development...etup-handlers/ the result-view-type is not support with viewSetupHandler, only these types:
    • list – main list view;
    • detail – main detail view;
    • edit – main edit view;
    • record/list – list record view;
    • record/search – search view;
    • record/detail – detail record view;
    • record/edit – detail record view;
    • record/kanban – kanban record view;
    Long story short: Is there any way of executing some custom code when a refresh/sorting action happens in a report result-view, either by overwriting the baseview or by any other means?

    Any help would be greatly appreciated
    Last edited by robin; 03-20-2026, 04:42 PM.
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9746

    #2
    Hi,

    In the new versions we have the ability to hide/show list report columns in the result view. Maybe it would be a suitable option for you?

    Comment


    • yuri
      yuri commented
      Editing a comment
      Additionally, did you try setting the content width wide at Preferences > User Interface. If will make the result view wider.
  • robin
    Junior Member
    • Aug 2025
    • 13

    #3
    Hi yuri,
    thanks for the response.
    Hiding some columns wouldn't solve the problem since there is 26 columns and at least half of them would need to be disabled to make space to display the rest, however the nature of the report requires most of the columns to be visible conccurently.

    I've tried setting the User interface to wide and it helped somewhat by giving the table some more space, but unfortunately its not enough as the table needs to be about 300% bigger than it currently is. And unless all my users get a ultrawidescreen that still doesnt fix the problem completly.

    So I assume there is no way to solve this problem in my intended way, by overwriting some code in the baseview?

    Comment

    • yuri
      EspoCRM product developer
      • Mar 2014
      • 9746

      #4
      The internals of that view have no official API, and it's closed sourced. We tend to modify this code that breaks customizations.

      I'd consider modifying it with a CSS outside of that particular view. You can try an additional global CSS.

      Or maybe consider exporting such large report to spreadsheets.

      Comment

      • robin
        Junior Member
        • Aug 2025
        • 13

        #5
        Understandable.

        I've tried the global css to start with, however since I dont want every report to be super wide (just one or two particualar ones) I've came up with adding a field to the report configuration where I can enter a tableWidth in percent, which then gets applied as a css width through the javascript code.

        But yeah I suppose if my users want to view that report and also sort through it, they can just export it to excel. Which I originally wanted to avoid since the report I am trying to replace by using EspoCRMs report function was an excel file xD
        But I suppose generating the report through EspoCRM still beats manually entering lines in the old report-excel by hand..

        In any case, thank you for your help yuri

        Comment

        Working...