The system was built with modal 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 another in the modal in the 1st level), but not always this modal is called from the same place so when you finish the action it is possible that these two grids do not exist below it, so every time we use grid.fnDraw()
in JS we need to first check if the grid in question exists with if(typeof(grid) != "undefined"
.
I would like an option to no longer need 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();
}
Therearecaseswherewereloadseveralgridsthatmaynotexistatthattime:
//Concluíuumaaçãoeprecisaatualizarosdadosdasgridsabaixodamodalif(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 not pass an undefined variable by parameter.
So I need a way to be able to pass the grid as a parameter even if it is as "undefined"
or a better solution so that you no longer have to use that if
before reloading the grid.