The beforeOutput event occurs after data has been selected from the database and ready to be sent to client side
$gridConn->event->attach("beforeOutput",myFunction);
In this event myFunction doesn't get any parameters.
Event can be used to mix some custom data in XML output.
Most common use-case - header structure for the grid.
$grid = new GridConnector($res); function grid_header(){ echo '<head> <column width="50" type="dyn" align="right" color="white" sort="str">Sales</column> <column width="150" type="ed" align="left" color="#d5f1ff" sort="str">Book Title</column> </head>'; } $grid->event->attach("beforeOutput","grid_header"); $grid->render_table("grid50000","item_id","item_nm,item_cd");
In case of dyn. loading mode, one more check need to be added, to prevent data output for additional data calls.
$grid = new GridConnector($res); function grid_header(){ if (!isset($_GET["posStart"])) echo '<head> <column width="50" type="dyn" align="right" color="white" sort="str">Sales</column> <column width="150" type="ed" align="left" color="#d5f1ff" sort="str">Book Title</column> </head>'; } $grid->event->attach("beforeOutput","grid_header"); $grid->dynamic_loading(100); $grid->render_table("grid50000","item_id","item_nm,item_cd");