There’s this documentation showing how to format data prior to sending to the client, but I can’t get it to work when using JSONDataConnector.
$data1 = new JSONDataConnector($this->connection, $dbtype);
function someFunction( $data ) {
// custom logic
};
$data1->event->attach("beforeRender","someFunction");
ConnectorSecurity::$security_key = true;
ConnectorSecurity::$xss = DHX_SECURITY_SAFEHTML;
ConnectorSecurity::$xss = DHX_SECURITY_TRUSTED;
$data1->dynamic_loading(200);
$data1->render_table("SELECT * FROM table",
"id",
"column1, column2");
The error that is thrown is: “Incorrect function assigned to: someFunction”
Any help would be appreciated.
UPDATE:
As soon as I posted this I figured it out. I can format the data by passing a class handler such as:
class SomeBehavior{
public function beforeRender($data){
//some logic -- this works
$t = $data->get_value("amazon_order_id");
$data->set_value("amazon_order_id",date("m-d-Y",strtotime($data)));
}
}