Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Formating Grid Decimals - Currency 29 Jul 2021 12:44 #15851

Hi,
I'd like my currency values to hide the cents... so in the Grid - just show $99 and not $99.00.

(All those extra ".00" are taking up valuable width in my List).

I've set these fields to be type Decimal 10,0 - but the 2 decimal places show up in the JCook generated lists. (That could be a bug to fix one day).

In my default_grid.php is this JDom:
echo JDom::_('html.fly.decimal.financial', array(
						'currencyFormat' => '$ %s',
						'dataKey' => 'total_cost',
						'dataObject' => $row,
						'emptyZero' => true
					));

What do I add or change in here?
Just call me Chris :)

Please Log in or Create an account to join the conversation.

Formating Grid Decimals - Currency 02 Aug 2021 09:37 #15852

The decimals property should work - but there is a bug in the JDom.

This is the code that should work - to set the decimal in a financial decimal...
echo JDom::_('html.fly.decimal.financial', array(
						'currencyFormat' => '$ %s',
                                                'decimals' => '0',
						'dataKey' => 'total_cost',
						'dataObject' => $row,
						'emptyZero' => true
					));

But there is a problem with the JDOM code financial.php at line 52 here...

Bad code:
if (empty($this->decimals))
			$this->decimals = 2;

The code sees "decimal = 0" as empty - and defaults to 2 decimal places!

This code needs to be
if (!isset($this->decimals))
			$this->decimals = 2;

To fix this you need to manually edit line 52 of /public_html/libraries/jdom/html/fly/decimal/financial.php
Just call me Chris :)
The following user(s) said Thank You: Romkabouter

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.074 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started