Formating data prior to sending to client?

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

        ConnectorSecurity::$security_key = true;
        ConnectorSecurity::$xss = DHX_SECURITY_SAFEHTML;
        ConnectorSecurity::$xss = DHX_SECURITY_TRUSTED;


        $data1->render_table("SELECT * FROM table",
            "column1, column2");

The error that is thrown is: “Incorrect function assigned to: someFunction”

Any help would be appreciated.


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");