any php code before render is executed as many times as the render function is typed
for example I have some code
if ($_GET['do_some_stuff'] == 1){
// do some stuff;
}
………
………………….
…
g = new jqgrid();
$out = $g->render("list1");
What happens is the // do some stuff; part is executed 2 times
AND
if ($_GET['do_some_stuff'] == 1){
// do some stuff;
}
………
………………….
…
g1 = new jqgrid();
g2 = new jqgrid();
$ou1t = $g1->render("list1");
$out2 = $g2->render("list1");
What happens is the // do some stuff; part is executed 3 times
Huge issue
The grid is loaded with 2 server calls.
1) load the columns of grid.
2) do an ajax call, to load data of grid.
When you have 2 grids, one call will load structure of both grids, and second+third ajax call for loading data of each grid.
For loading data, the ajax call have param 'grid_id' passed in $_GET, so if you want to run above code only once, you can put IF condition something like:
if (!isset($_GET["grid_id"]))
{
// once runnable code, when creating grid structure.
}