Hi together,
I have already finished a grid with time calculation. everything's working fine. Now I try to Display a total sum of one col in the footer.
my code is like this:
$g->select_command = "
SELECT ENT_Zeit.id, ENT_Zeit.sachbearbeiter_id,
ENT_Zeit.bericht_id, ENT_Zeit.datum,
ENT_Zeit.von, ENT_Zeit.bis,
SEC_TO_TIME( UNIX_TIMESTAMP( bis ) – UNIX_TIMESTAMP( von) ) AS zeit,
(SELECT sum(zeit) from ENT_Zeit) as zeit_gesamt
FROM ENT_Zeit
where bericht_id = '" . $var_id . "'";
$g->table = "ENT_Zeit";
>> this SQL Statement works fine. I want to get a sumary of the calculated COL "zeit". I have added an SQL Statement für building a total sumary in SQL "zeit_gesamt"
>> then I added this code
$e["js_on_load_complete"] = "grid_onload";
$g->set_events($e);
<script>
function grid_onload()
{
var grid = $("hpcBerichtZeit"),
sum = grid.jqGrid('getCol', 'zeit_gesamt');
grid.jqGrid('footerData','set', {total: 'Summe: '+sum[0]});
};
</script>
>> No Data is Displayed in Footer. If I use "$grid->set_events($e);", as it is written in all Demos, the Website is unable to load.
thank you for any notice
Hello Thomas,
Please share you full code for review.
You can post code at pastebin.com and share the link OR email me at [email protected]