Overview
  • Namespace
  • Class

Namespaces

  • Ublaboo
    • DataGrid
      • AggregationFunction
      • Column
      • Components
        • DataGridPaginator
      • DataSource
      • Exception
      • Export
      • Filter
      • GroupAction
      • InlineEdit
      • Localization
      • Status
      • Toolbar
      • Traits
      • Utils

Classes

  • Ublaboo\DataGrid\AggregationFunction\FunctionSum
  • Ublaboo\DataGrid\Column\Action
  • Ublaboo\DataGrid\Column\ActionCallback
  • Ublaboo\DataGrid\Column\Column
  • Ublaboo\DataGrid\Column\ColumnDateTime
  • Ublaboo\DataGrid\Column\ColumnLink
  • Ublaboo\DataGrid\Column\ColumnNumber
  • Ublaboo\DataGrid\Column\ColumnStatus
  • Ublaboo\DataGrid\Column\ColumnText
  • Ublaboo\DataGrid\Column\FilterableColumn
  • Ublaboo\DataGrid\Column\ItemDetail
  • Ublaboo\DataGrid\Column\MultiAction
  • Ublaboo\DataGrid\Column\Renderer
  • Ublaboo\DataGrid\ColumnsSummary
  • Ublaboo\DataGrid\Components\DataGridPaginator\DataGridPaginator
  • Ublaboo\DataGrid\CsvDataModel
  • Ublaboo\DataGrid\DataGrid
  • Ublaboo\DataGrid\DataModel
  • Ublaboo\DataGrid\DataSource\ApiDataSource
  • Ublaboo\DataGrid\DataSource\ArrayDataSource
  • Ublaboo\DataGrid\DataSource\DibiFluentDataSource
  • Ublaboo\DataGrid\DataSource\DibiFluentMssqlDataSource
  • Ublaboo\DataGrid\DataSource\DoctrineCollectionDataSource
  • Ublaboo\DataGrid\DataSource\DoctrineDataSource
  • Ublaboo\DataGrid\DataSource\FilterableDataSource
  • Ublaboo\DataGrid\DataSource\NetteDatabaseTableDataSource
  • Ublaboo\DataGrid\DataSource\NetteDatabaseTableMssqlDataSource
  • Ublaboo\DataGrid\DataSource\NextrasDataSource
  • Ublaboo\DataGrid\Export\Export
  • Ublaboo\DataGrid\Export\ExportCsv
  • Ublaboo\DataGrid\Filter\Filter
  • Ublaboo\DataGrid\Filter\FilterDate
  • Ublaboo\DataGrid\Filter\FilterDateRange
  • Ublaboo\DataGrid\Filter\FilterMultiSelect
  • Ublaboo\DataGrid\Filter\FilterRange
  • Ublaboo\DataGrid\Filter\FilterSelect
  • Ublaboo\DataGrid\Filter\FilterText
  • Ublaboo\DataGrid\Filter\SubmitButton
  • Ublaboo\DataGrid\GroupAction\GroupAction
  • Ublaboo\DataGrid\GroupAction\GroupActionCollection
  • Ublaboo\DataGrid\GroupAction\GroupMultiSelectAction
  • Ublaboo\DataGrid\GroupAction\GroupSelectAction
  • Ublaboo\DataGrid\GroupAction\GroupTextAction
  • Ublaboo\DataGrid\GroupAction\GroupTextareaAction
  • Ublaboo\DataGrid\InlineEdit\InlineEdit
  • Ublaboo\DataGrid\Localization\SimpleTranslator
  • Ublaboo\DataGrid\Row
  • Ublaboo\DataGrid\Status\Option
  • Ublaboo\DataGrid\Toolbar\ToolbarButton
  • Ublaboo\DataGrid\Utils\ArraysHelper
  • Ublaboo\DataGrid\Utils\DateTimeHelper
  • Ublaboo\DataGrid\Utils\ItemDetailForm
  • Ublaboo\DataGrid\Utils\NetteDatabaseSelectionHelper
  • Ublaboo\DataGrid\Utils\PropertyAccessHelper
  • Ublaboo\DataGrid\Utils\Sorting

Interfaces

  • Ublaboo\DataGrid\AggregationFunction\IAggregatable
  • Ublaboo\DataGrid\AggregationFunction\IAggregationFunction
  • Ublaboo\DataGrid\AggregationFunction\IMultipleAggregationFunction
  • Ublaboo\DataGrid\DataSource\IDataSource
  • Ublaboo\DataGrid\Filter\IFilterDate

Traits

  • Ublaboo\DataGrid\AggregationFunction\TDataGridAggregationFunction
  • Ublaboo\DataGrid\Traits\TButtonCaret
  • Ublaboo\DataGrid\Traits\TButtonClass
  • Ublaboo\DataGrid\Traits\TButtonIcon
  • Ublaboo\DataGrid\Traits\TButtonText
  • Ublaboo\DataGrid\Traits\TButtonTitle
  • Ublaboo\DataGrid\Traits\TButtonTryAddIcon
  • Ublaboo\DataGrid\Traits\TLink

Exceptions

  • Ublaboo\DataGrid\Exception\DataGridActionCallbackException
  • Ublaboo\DataGrid\Exception\DataGridArrayDataSourceException
  • Ublaboo\DataGrid\Exception\DataGridColumnException
  • Ublaboo\DataGrid\Exception\DataGridColumnNotFoundException
  • Ublaboo\DataGrid\Exception\DataGridColumnRendererException
  • Ublaboo\DataGrid\Exception\DataGridColumnStatusException
  • Ublaboo\DataGrid\Exception\DataGridDateTimeHelperException
  • Ublaboo\DataGrid\Exception\DataGridException
  • Ublaboo\DataGrid\Exception\DataGridFilterNotFoundException
  • Ublaboo\DataGrid\Exception\DataGridFilterRangeException
  • Ublaboo\DataGrid\Exception\DataGridGroupActionException
  • Ublaboo\DataGrid\Exception\DataGridHasToBeAttachedToPresenterComponentException
  • Ublaboo\DataGrid\Exception\DataGridItemDetailException
  • Ublaboo\DataGrid\Exception\DataGridWrongDataSourceException
 1 <?php
 2 
 3 /**
 4  * @copyright   Copyright (c) 2015 ublaboo <ublaboo@paveljanda.com>
 5  * @author      Pavel Janda <me@paveljanda.com>
 6  * @package     Ublaboo
 7  */
 8 
 9 namespace Ublaboo\DataGrid\Column;
10 
11 use Ublaboo\DataGrid\Row;
12 
13 class ColumnNumber extends Column
14 {
15     /**
16      * @var string
17      */
18     protected $align = 'right';
19 
20     /**
21      * @var array
22      */
23     protected $number_format = [
24         0, // Decimals
25         '.', // Decimal point
26         ' '  // Thousands separator
27     ];
28 
29 
30     /**
31      * Format row item value
32      * @param  Row   $row
33      * @return mixed
34      */
35     public function getColumnValue(Row $row)
36     {
37         $value = parent::getColumnValue($row);
38 
39         if (!is_numeric($value)) {
40             return $value;
41         }
42 
43         return number_format(
44             $value,
45             $this->number_format[0],
46             $this->number_format[1],
47             $this->number_format[2]
48         );
49     }
50 
51 
52     /**
53      * Set number format
54      * @param int    $decimals
55      * @param string $dec_point
56      * @param string $thousands_sep
57      */
58     public function setFormat($decimals = 0, $dec_point = '.', $thousands_sep = ' ')
59     {
60         $this->number_format = [$decimals, $dec_point, $thousands_sep];
61 
62         return $this;
63     }
64 
65 
66     /**
67      * @return array
68      */
69     public function getFormat()
70     {
71         return [
72             $this->number_format[0],
73             $this->number_format[1],
74             $this->number_format[2]
75         ];
76     }
77 
78 }
79 
API documentation generated by ApiGen