Export>Print function not retaining all formats in nested grids - any ideas?

I have a nested grid that combines several grids into a report, which can be viewed or printed.

I have a perfect format on the screen, but when I click on the Print button (and others, but print is the key), the previewed page (Created by tb_show() using the appname_config.print.php file) does not show all of the formatting.

This seems to be specifically limited to Summary grid content, where I have background coloured specific cells depending on the content. (I search for the content in the elements of a particular class and then add the relevant class to get my colour formatting and this works very weell on all screens, but fails in the report print/export)

If you print the non-nested version of the app it works exactly as expected!
I’ve reapplied this same formatting in the main grid and that makes no difference!

Everywhere else, I’m generally formatting in the grid without adding a class and this works fine. Directly colouring the element without a class doesn’t work either.

Any ideas?

Further build on this…

  1. If you colour records or elements directly using PHP echos, they work fine and print.
  2. If you use jQuery /Javascript to colour elements of the DOM/grid, then these don’t get carried forward into the tb_show() function that does the printing.
    I presume that when you click on print and running the appname.config.print.php file it doesn’t repeat any javascript calls (Which are echod in the onScriptinit of the grid).

I don’t know anything about tb_show and how the configuration file works so Im stuck.

Any builds?

Edit1: I’ve found a solution using the onGroupby event, which fires when you print a grid!
Unfortunately this event is not being generated in the right place (Its at the top of the app… even above the Doctype declaration)
See problem here: https://forum.scriptcase.net/t/uncaught-referenceerror-is-not-defined-caused-when-using-ongroupby-event-s/37505