How to disable formatter for Grouping footer total

QuestionsHow to disable formatter for Grouping footer total
Richard Samson asked 6 years ago

Hi,

I’m using your grouping.php demo for guidance but having problems displaying my grand total.

I have a column named “percent_complete” which uses the following 2 parameters for calculating the groups average:

$col[“summaryType”] = “avg”;
$col[“summaryTpl”] = “<b>Total: {0}%</b>”;

This generates a number with a lot of decimal places, so I’ve added the following format options to this column:

$col[“formatter”] = “number”;
$col[“formatoptions”] = array( “thousandsSeparator” => “,”,”decimalSeparator” => “.”,”decimalPlaces” => 0);

However, doing this has caused my grand total to return a NaN result, I’m using the following within my filter_display function, called by event on_data_display:

$data[“params”][“userdata”] = array(“key_count”=>”Grand Total: “,”percent_complete”=>$total.”%”);

I believe the reason for the NaN is that I’m outputting the value as a string instead of a number (as per the column formatting).  If I remove the concatenated “%” from the returning value the number displayed fine, but I’d really like to include the % symbol when displaying to my users.

How can I disable the formatter for the userdata parameters, or for this specific column within the footer?

Many Thanks.

1 Answers
Abu Ghufran Staff answered 6 years ago

Use summaryRound along with number formatter:

e.g.
$col = array();
$col[“title”] = “Total”;
$col[“name”] = “total”;
$col[“width”] = “50”;
$col[“editable”] = true;
$col[“formatter”] = “number”;
$col[“summaryType”] = “avg”; // available grouping fx: sum, count, min, max, avg
$col[“summaryRound”] = 2; // decimal places
$col[“summaryRoundType”] = ‘fixed’; // round or fixed
$col[“summaryTpl”] = ‘Total ${0}’; // display html for summary row – work when “groupSummary” is set true. search below
$cols[] = $col;

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

5 + 16 =

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?