Uncaught ReferenceError: $ is not defined... caused when using onGroupby event(s)

Hi

I’ve got a wierd one… I have a javascript function that I echo into existance in the onScriptInit event.
It works fine in the normal grid and does the job.

However, when I try to use it in the Groupby events
Ashampoo_Snap_Friday, 27 June 2025_21h21m34s

I get a console error (Uncaught ReferenceError: $ is not defined) caused by the fact that scriptcase loads the text at the very top of the HTML page… even before the Doctype and other header text.

Ashampoo_Snap_Friday, 27 June 2025_21h25m50s

Because the Groupby actually works more than once, the function still works (second call onwards I think), but I’m bemused how to prevent this from happening in the first place.

Any Ideas/builds?

EDIT1: This is not constrained to the javascript echo above. If I simply put an echo(“Hello”); in the ongroupby if appears at the top of the source.

Edit2: It also causes an error in MOST browsers (except for Chrome) when you do the Layout>Group By and change the groupby to the one with the event (Dynamic groupBy). Safari puts a popup window with an echo of the function called (but in the background changes the groupby). When it completes, nothing has changed… but if you go into summary, it is correct and when you come back the grid is as youd expect it.