51
Views
3
Comments
Solved
[OutSystems Data Grid] Error SetViewLayout when changing tabs
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

I have several tabs and in each of those I have a data grid, when I switch tabs a bit faster before the content is all loaded I get the example error:

that comes from the SetViewLayout action 

in the OnInitialize of the grid I get the saved view from the DB and apply it with the SetViewLayout but if I switch tabs very fast then the setview returns the error and from debugging it still has the id before the setview.

I tried to replicate in my personal environment but I couldn't mainly due to not have as much data and configuration. Also this does not happen to all the grids in the tabs.

What options do I have to fix this?

Thanks.

GA

2024-12-02 12-15-17
Aravind EONE
Solution

Hi @Gonçalo Aguiar ,

1) Create a local variable IsDestroyed in the block

2) Use the OnDestroy event handler of the block to set the IsDestroyed = true

3) Place an If wherever you're using GRID ID.

4) Check if the IsDestroyed = true ... and if yes ... go to End - because the block has already been destroyed. So no need to call the destroyed GRID ID.


Hope this helps


2024-12-02 12-15-17
Aravind EONE

1. Add an If condition above your GRID and check if data fetched or not when you click on each tab.

2. If data fetched then you will show the Grid to proceed.


Hope it helps.

2022-03-29 16-12-55
Gonçalo Aguiar

Hi maybe I didn't explain properly.

I have Tab 1, Tab 2, Tab 3 each with the respective grid inside a webblock.

I click Tab 2 and switch click as fast as I can on Tab 3. 

Tab 3 is rendered with the grid and I get the error saying it didn't found the Grid 2.

I have a condition to only show the webblocks with the grids after the OnTabChange so only 1 grid is active at any time.

The issue here is that I don't want to continue with the OnInitialize flow of the Tab 2 when I already switched to another Tab.

Thanks.

2024-12-02 12-15-17
Aravind EONE
Solution

Hi @Gonçalo Aguiar ,

1) Create a local variable IsDestroyed in the block

2) Use the OnDestroy event handler of the block to set the IsDestroyed = true

3) Place an If wherever you're using GRID ID.

4) Check if the IsDestroyed = true ... and if yes ... go to End - because the block has already been destroyed. So no need to call the destroyed GRID ID.


Hope this helps


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.