Number column

Implements

Methods for Mesour\DataGrid\Column\Number

Method Default Possible values Returns Required Description
setDecimals 0 int $decimals Mesour\DataGrid\Column\Number no Set the number of decimal places
setDecimalPoint . string $decimalPoint Mesour\DataGrid\Column\Number no Set decimal point
setThousandsSeparator , string $separator Mesour\DataGrid\Column\Number no Set thousands separator
setUnit none string $unit Mesour\DataGrid\Column\Number no Set unit for this number
setCallback none callable $callback Mesour\DataGrid\Column\Number no If you use callback, column shows output of this callback

Callback parameters for method setCallback

Parameter Type Description
$column Mesour\DataGrid\Column\Number Number column instance
$rowData Mesour\Sources\ArrayHash / Entity / ActiveRow Data for current row
$formatted string Formatted number

Events

Info See onRenderon events page

Usage

$mesourApp = //instance Mesour\Components\Application\IApplication
$source = //some <a href="http://components.mesour.com/version3/component/sources/" target="_blank">data source</a> or two-dimensional array

$grid = new Mesour\UI\DataGrid('numberDataGrid', $mesourApp);

$grid->setSource($source);

$grid->addText('name', 'Name');

$grid->addText('surname', 'Surname');

//! here add status column
$grid->addNumber('amount', 'Amount')
    ->setUnit('USD')
    ->setThousandsSeparator(',')
    ->setDecimals(2)
    ->setDecimalPoint('.');

$grid->addText('email', 'E-mail');

$grid->render();

Demo


NameSurnameAmountE-mail
JohnDoe0.00 USDjohn.doe@test.xx
PeterLarson15,220.65 USDpeter.larson@test.xx
ClaudeGraves9,876.47 USDclaude.graves@test.xx
StuartNorman98,766.21 USDstuart.norman@test.xx
KathyArnold456.99 USDkathy.arnold@test.xx
JanWilson123.00 USDjan.wilson@test.xx
AlbertaErickson98,753.65 USDalberta.erickson@test.xx
AdaWells852.37 USDada.wells@test.xx
EthelFigueroa45,695.99 USDethel.figueroa@test.xx
IanGoodwin1,236.99 USDian.goodwin@test.xx
FrancisHayes5,498.35 USDfrancis.hayes@test.xx
ErmaBurns63,287.99 USDerma.burns@test.xx
KristinaJenkins74,523.97 USDkristina.jenkins@test.xx
VirgilHunt65,654.65 USDvirgil.hunt@test.xx
MaxMartin541,236.55 USDmax.martin@test.xx
MelodyManning9,871.22 USDmelody.manning@test.xx
CatherineTodd100.20 USDcatherine.todd@test.xx
DouglasStanley900.00 USDdouglas.stanley@test.xx
PattiDiaz1,500.00 USDpatti.diaz@test.xx
JohnPetterson2,500.00 USDjohn.petterson@test.xx