0
The system was built with modals and it is possible that there is a modal there in the 2nd level that needs to update two grids below (one in the main screen and the other in the modal in the 1st level)but not always this modal is called from the same place so when completing the action it is possible that these two grids do not exist below it, just every time we will use grid.fnDraw()
in JS we need to check first if the grid in question exists with the if(typeof(grid) != "undefined"
.
I wanted an option so I don’t have to check every time I reload a grid if it exists.
I thought of something like creating a method like this:
function recarregarGrid(grid) {
if (typeof (grid) != "undefined")
grid.fnDraw();
}
There are cases where we reload several grids that may not exist at that time:
//Concluíu uma ação e precisa atualizar os dados das grids abaixo da modal
if(typeof(gridItem) != "undefined")
gridItem.fnDraw();
if(typeof(gridFornecedor) != "undefined")
gridFornecedor.fnDraw();
if(typeof(gridLocalEntrega) != "undefined")
gridLocalEntrega.fnDraw();
if(typeof(gridStackOverflow) != "undefined")
gridStackOverflow.fnDraw();
But anyway I can’t pass a Undefined variable per parameter.
So I need a way to pass the grid as a parameter even if it’s like "undefined"
or a better solution to no longer need to use this every time if
before reloading the grid.
how about putting the
if
within the functionfnDraw
?– Marllon Nasser
I can’t use it. fnDraw on a Undefined variable and because of that it bursts error, so no use I put inside fnDraw because it doesn’t even get there
– Andrey Hartung
grid
would be related to an element of the FOD?– Guilherme Lautert
The grid structure is in HTML, but the grid is mounted in JS and loaded in HTML.
– Andrey Hartung