Hi
I am storing the grid config in a JSON file on the server. I want to include the contents of that file with the data. I am using the beforeOutput event to insert the config data (per the sample code) but it is not being sent. Only the actual data is being sent. I have tried a number of things like including the data in my beforeOutput output but nothing I echo gets outputted.
The doco says that the beforeOutput event gets no parameters however Stan has mentioned in this forum that it gets the connector and the data. That does not seem to be correct.
Anyway my key objective is to include the config from a file in the data output of the render.
How can I do that please.
My sample code is:
[code]require_once(“codebase/data_connector.php”);
require_once(“codebase/db_mysqli.php”);
function outputHeader($conn, $data){
LogMaster::log(“I arrived in outputHeader”);
echo "{head:[
{id:'deviceID', width:105, type:'ro', align:'left', sort:'str', value:'device'},
{id:'displayName', width:100, type:'ro', align:'left', sort:'str', value:'U(device)U'},
{id:'lastContact', width:70, type:'ro', align:'left', sort:'date', value:'T(lastcontact)T'},
{id:'expirationTime', width:70, type:'ro', align:'left', sort:'date', value:'T(expires)T'},
{id:'licensePlace', width:'*', type:'ro', align:'left', sort:'str', value:'T(licenseplate)T'}
], rows: $data }";
return false;
};
function navListComplexSql($sql, $key, $list){
global $acc, $dbh;
$gridConn = new JSONDataConnector($dbh, “MySQLi”);
$gridConn->enable_log(“navList.log”);
LogMaster::log(“any text here”);
$gridConn->event->attach(“beforeOutput”,“outputHeader”);
$gridConn->filter(“accountID”, $acc);
$gridConn->render_complex_sql($sql,$key,$list);
}
function navListComplexSql($sql, $key, $list){
global $acc, $dbh;
$gridConn = new JSONDataConnector($dbh, “MySQLi”);
$gridConn->enable_log(“navList.log”);
LogMaster::log(“any text here”);
$gridConn->event->attach(“beforeOutput”,“outputHeader”);
$gridConn->filter(“accountID”, $acc);
$gridConn->render_complex_sql($sql,$key,$list);
}
navListComplexSql($sql,“deviceID”, “deviceID, displayName, lastContact, expirationTime, licensePlate”);
[/code]