[Data Grid Web] Javascript code loads first than the intended component (DataGrid)
Forge component by OutSystems R&D
Published on 14 Dec 2020

Soo I have this javascript code that its working but the only problem is that when the page loads the javascript code loads first than the DataGrid Table, soo it wont work because it doesnt receive any id from the table. Is there any solution to solve this? 

Print of the javascript code down bellow.

Regards, Nuno


Rank: #148

Hi Nuno,

You can check the Data Grid Sample oml available in the forge and observe that they have placed the javascript web block after the datagrid and all the functions written inside those web blocks are working fine. Similarly, you can place your javascript code inside webblock and place them after your Datagrid, so that even on page refresh your code will work.

Hope this helps,


Manish Jawla

Rank: #6696

I, thank you for the help but didnt worked this way, I probably was doing something wrong but i've now managed to get a solution to this problem

Rank: #481

Hello @Nuno Gonçalves

to complement @Manish Jawla 's answer, you can also use the method afterGridInit. 

GridOS.ExternalAPI.afterGridInit -> adds a callback method to fire when the grid has been initialized.

So you just need to add your code inside the method:


    //do things