Remove table column using javascript in a reactive app

Hello everybody,

I have a reactive app and im trying to use javascript in an OnReady action of a screen to remove the first column from a table.
This is my javascript:


This is what i get in the screen:


So the first cell of the header is deleted but the cells from the tbody are not.
I did some tests and it seems that the table.rows lenght is 1 but if i use javascript directly on the chrome developer tools this happens:

Can somebody help me with this?

Flávio Monteiro wrote:

Hello everybody,

I have a reactive app and im trying to use javascript in an OnReady action of a screen to remove the first column from a table.
This is my javascript:


This is what i get in the screen:


So the first cell of the header is deleted but the cells from the tbody are not.
I did some tests and it seems that the table.rows lenght is 1 but if i use javascript directly on the chrome developer tools this happens:

Can somebody help me with this?

 Hi,

Could you please try enclose in function and call the function on load of table.

Hope this helps 

Thanks 

AD

 

Hi Flavio,

At the time the onReady runs, your aggregate is not back with data yet, and so the only row in there at that point is the header.  So you'll have to wait until the OnAfterFetch of the aggregate to do this.

More importantly, though, why do you hide a column with Javascript ?  Is there no low-code way to accomplish what you are trying ?

Dorine

Edit, i don't even think the onAfterFetch, because then the Dom is probably not updated with the aggregate data yet, so that leaves you with the OnRender event in combination with the IsDataFetched of the aggregate, I guess.

Hi Flavio,

If you have more records and your requirement is only to remove the first row of the table, why don't you use CSS to do it? something like below:

Regards,

Karthik

Karthik Nataraj wrote:

Hi Flavio,

If you have more records and your requirement is only to remove the first row of the table, why don't you use CSS to do it? something like below:

Regards,

Karthik

 Yes,

that's what I meant Karthik, wouldn't even need new css rule, just add hidden class to the cells that you want to hide.  This can even be conditional.


See attached oml, showcasing how many rows there are during life cycle of screen, and showing how to hide/show first column with switch.

Dorine