record grid

A place for users and developers of the Xataface to discuss and receive support.

record grid

Postby samhans » Mon Mar 26, 2012 9:34 am

hai Steve and all,
this is my record grid action code:

class actions_testTableAction {

// Will be called from Xataface, if this action is called
function handle(&$params){
$this->app =& Dataface_Application::getInstance(); // reference to Dataface_Application object

// Custom query
$result = mysql_query("select id, in_stock, outstock from( (select id, sum(qty) from inciming )as in_stock) left join (select id, sum(out_qty) from outgoing_catridge) as outstock) group by printr_model ", $this->app->db());
$body = "<br /><br />";

// Error handling
$body .= "MySQL Error ...";
while($row = mysql_fetch_assoc($result)) // Fetch all rows
// Maybe do something with the single rows
$data[] = $row; // Add singe row to the data
mysql_free_result($result); // Frees the result after finnished using it

$grid = new Dataface_RecordGrid($data); // Create new RecordGrid with the data

$body .= $grid->toHTML(); // Get the HTML of the RecordGrid

// Shows the content (RecordGrid or error message) in the Main Template
df_display(array('body' => $body), 'Dataface_Main_Template.html');

steve this is the code in action , it is working fine but what i want is a third column balance where i could minus the in stock and outstock rows to get the value.
i have done it when i use to echo my owntable. but i dont know how could i insert in a record grid object.

thanks for help
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved