Date column

Implements

Methods for Mesour\DataGrid\Column\Date

Method Default Possible values Returns Required Description
setFormat Y-m-d string $format Mesour\DataGrid\Column\Date no Set the format of the date
setCallback none callable $callback Mesour\DataGrid\Column\Date no If you use callback, column shows output of this callback

Callback parameters for method setCallback

Parameter Type Description
$column Mesour\DataGrid\Column\Date Number column instance
$rowData Mesour\Sources\ArrayHash / Entity / ActiveRow Data for current row
$date DateTime DateTime instance
$FormattedDate string Formatted date

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');

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

//! here add date column
$grid->addDate('last_login', 'Last login')
    ->setFormat('Y-m-d H:i:s');

$grid->render();

Demo


NameSurnameE-mail
JohnDoejohn.doe@test.xx-
PeterLarsonpeter.larson@test.xx2014-09-09 13:37:32
ClaudeGravesclaude.graves@test.xx2014-09-02 14:17:32
StuartNormanstuart.norman@test.xx2014-09-09 18:39:18
KathyArnoldkathy.arnold@test.xx2014-09-07 10:24:07
JanWilsonjan.wilson@test.xx2014-09-03 13:15:22
AlbertaEricksonalberta.erickson@test.xx2014-08-06 13:37:17
AdaWellsada.wells@test.xx2014-08-12 11:25:16
EthelFigueroaethel.figueroa@test.xx2014-09-05 10:23:26
IanGoodwinian.goodwin@test.xx2014-09-04 12:26:19
FrancisHayesfrancis.hayes@test.xx2014-09-03 10:16:17
ErmaBurnserma.burns@test.xx2014-07-02 15:42:15
KristinaJenkinskristina.jenkins@test.xx2014-08-20 14:39:43
VirgilHuntvirgil.hunt@test.xx2014-08-12 16:09:38
MaxMartinmax.martin@test.xx2014-09-01 12:14:20
MelodyManningmelody.manning@test.xx2014-09-02 12:26:20
CatherineToddcatherine.todd@test.xx2014-06-11 15:14:39
DouglasStanleydouglas.stanley@test.xx2014-04-16 15:22:18
PattiDiazpatti.diaz@test.xx2014-09-11 12:17:16
JohnPettersonjohn.petterson@test.xx2014-10-10 10:10:10