Basic functionality

Usage

Info Easy way to create simple DataGrid :-)
//! application
$application = new Mesour\UI\Application;
$application->setRequest($_REQUEST);
$application->run();

//! source
$data = [
    ['id' => 1, 'name' => 'John', 'amount' => 1546],
    ['id' => 2, 'name' => 'Peter', 'amount' => 351],
    ['id' => 3, 'name' => 'Peter', 'amount' => 351],
];
$source = new Mesour\DataGrid\Sources\ArrayGridSource('users', 'id', $data);

//! grid
$grid = new Mesour\UI\DataGrid('basicDataGrid', $this->mesourApp);

$grid->setSource($source);

$grid->addText('id', '#');

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

$grid->addNumber('amount', 'Amount')
    ->setUnit('USD') // defaults = NULL
    ->setThousandsSeparator(',') // defaults
    ->setDecimals(2) // defaults = 0
    ->setDecimalPoint('.'); // defaults

//! render :-)
$grid->render();

Demo


#NameAmount
1John1,546.00 USD
2Peter351.00 USD
3Peter351.00 USD