Hello,
I’m trying to do a grid with a column that stores the results of the addition of another column.
I’am using a simple MySQL table with the following fields: id, date, concept, amount, description, balance and entity.
I tried to use an example from a previos post but it does not work.
This is the code I’m using:
The html file:
CCsAnd this is the cc.php file:
<?php require_once("config.php"); $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); require("grid_connector.php"); $query="select id as ItemId, date as ItemDate, concept as ItemConcept, amount as ItemAmount, description as ItemDescription, '' as ItemBalance from tbl_bancs2 where entity=5"; $resconn = new GridConnector($res); $counter = 0; function calck($action) { global $counter; $counter = $counter + $action->get_value("ItemAmount"); $action->setValue("ItemBalance",$counter); } $resconn->event->attach("beforeRender","calck"); $resconn->render_sql($query,"ItemId", "ItemData,ItemConcept,ItemAmount,ItemDescription,ItemBalance"); ?>When I load the html file, a blank popup window appears and no data is loaded to the grid.
What am I doing wrong?