beforeOutput problem

I am using render_table to output my database info to a grid and I need to manually add some data to a cell in each row of the XML before it’s rendered to the grid. I am using beforeOutput but it is only adding the data before the first row and not in each row.

How do I get this entered into each row of the XML (preferably at the end of each row)?

Here is my code:

[code]
function addDelete($conn,$data){
$data->add(‘’);
}

$sql_db = ‘demo’;
$sql_conn_info = array(‘Database’=>$sql_db, ‘UID’=>$sql_user, ‘PWD’=>$sql_pass);

$conn = sqlsrv_connect($sql_server,$sql_conn_info);

$gridConn = new GridConnector($conn, ‘SQLSrv’);
$gridConn->event->attach(‘beforeOutput’, ‘addDelete’);
$gridConn->render_table(‘appData’,‘appID’,‘appName,appVersion,appDirectory,appType,appActive,appDB’);[/code]

Here is the XML output:

[code]

[/code]

Change beforeOutput to beforeRender

function addDelete($data){
  $data->set_value('button', 'Delete'); //set value for the fake column
}

$sql_db = 'demo';
$sql_conn_info = array('Database'=>$sql_db, 'UID'=>$sql_user, 'PWD'=>$sql_pass);

$conn = sqlsrv_connect($sql_server,$sql_conn_info);

$gridConn = new GridConnector($conn, 'SQLSrv');
$gridConn->event->attach('beforeRender', 'addDelete'); 
$gridConn->render_table('appData','appID','appName,appVersion,appDirectory,appType,appActive,appDB,appName(button)'); //add fake column

Thank you Stan but I tried using beforeRender and adding the ‘fake column’ and I receive an error stating “Invalid column name” because there is no column in the database to match it with.

$gridConn->render_table('appData','appID','appName,appVersion,appDirectory,appType,appActive,appDB,appDele');

====================================
Log started, 19/10/2015 08:04:50

SELECT appID,appName,appVersion,appDirectory,appType,appActive,appDB,appDele FROM appData

!!!Uncaught Exception
Code: 0
Message: SQLSrv operation failed
42S22207[Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name ‘appDele’.

Forget my last post. I missed a step. Your solution works great.

Thank you.