Sum for this "time" type of field

QuestionsSum for this "time" type of field
Davor Budimir asked 7 years ago

Hello Abu,

Sorry, but I have another question. I have a field of "time" type and I do group records. However sum for this type of field is not working correctly (sums up just hours).

code:

$col = array();
$col["title"] = "Efektivno vrijeme";
$col["name"] = "time";
$col["width"] = "100";
$col["align"] = "center";
$col["editable"] = false;
$col["search"] = false;
$col["formatter"] = "datetime";
$col["summaryType"] = "sum";

….

$grid["groupingView"]["groupSummary"] = array(true);

Please help,
Davor

1 Answers
Abu Ghufran answered 7 years ago

Perhaps you need to write custom function to calculate sum of minutes in summary

PHP Part …
$col["summaryType"] = "function(val, name, record) { return mysum(val, name, record) }";

JS part…
function mysum(val, name, record)
{
return parseFloat(val||0) + parseFloat((record[name]||0)); // just for e.g.
}

Your Answer

10 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?