Skip to main content
Question

I can’t convert JavaScript from the Classic UI to Modern UI TypeScript code.

  • March 7, 2026
  • 3 replies
  • 108 views

mos11
Freshman I
Forum|alt.badge.img
<ClientEvents TabChanging="refreshGrid" />
<px:PXJavaScript runat="server" ID="CstJavaScript23" Script="function refreshGrid(){ var custGridTotal = document.getElementById("ctl00_phG_tab_t6_CstFormView8&quot;); if(custGridTotal != null &amp;&amp; custGridTotal != undefined){ custGridTotal.object.refresh(); console.log(&quot;custGridTotal&quot;); } }" IsStartupScript="True" />

I want to convert my JavaScript code to Modern UI TypeScript code. How can I do it? I cannot find any documentation about it. I found @handleEvent in TypeScript, but it does not have TabChanging or many other events that exist in the JavaScript client-side.

3 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • March 9, 2026

@mos11  what are you trying to do here exactly? 

It seems you refresh the grid on changing tabs, but why do you even need it? 

Seems like that’s something that should not require any custom javascript/typescript.


mos11
Freshman I
Forum|alt.badge.img
  • Author
  • Freshman I
  • March 11, 2026

@Dmitrii Naumov In the classic UI, this will be a problem when the screen is opened from a Generic Inquiry or other places. But now in the Modern UI, I need to test it.


Forum|alt.badge.img+2
  • Jr Varsity III
  • March 14, 2026

@mos11 ,
Example pattern using @handleEvent.

import { PXScreen, PXView, handleEvent } from "client-controls";

export class SO301000_Extension extends PXScreen {

    CustGridTotal = new PXView();

    @handleEvent("screenLoad")
    onScreenLoad() {
        if (this.CustGridTotal) {
            this.CustGridTotal.refresh();
            console.log("custGridTotal refreshed");
        }
    }
}

 

If You Want It When a Tab Opens

Modern UI does not expose TabChanging, but you can detect tab activation using:

@handleEvent("viewActivated", { view: "CustGridTotal" })
onGridActivated() {
    this.CustGridTotal.refresh();
}

you can try like this code hope work for classic and modern UI.
protected void _(Events.RowSelected<YourDAC> e)
{
    if (Base.CustGridTotal != null)
    {
        Base.CustGridTotal.View.RequestRefresh();
    }
}