Example with DEMO

Example code

$source = new Mesour\DataGrid\Sources\NetteDbGridSource($this->db->table('doc_users'), 'doc_users', $this->db);

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

$grid->setSource($source);

$grid->enablePager(5);

$grid->enableEditable();

$grid->enableExport(__DIR__ . '/../temp/cache', 'full-grid.csv');

$grid->enableFilter();

$links = $grid->enableRowSelection()
    ->getLinks();

$links->addLink('Active');

$links->addLink('Inactive')
    ->setAjax(FALSE);

$links->addDivider();

$links->addLink('Delete')
    ->setConfirm('Really delete all selected users?');

$statusColumn = $grid->addStatus('action', 'S');

$statusColumn->addButton('active')
    ->setStatus(1, 'Active', 'All active')
    ->setIcon('check-circle')
    ->setType('success')
    ->setAttribute('href', '#');

$statusColumn->addButton('inactive')
    ->setStatus(0, 'Inactive', 'All inactive')
    ->setIcon('times-circle')
    ->setType('danger')
    ->setAttribute('href', '#');

$grid->addImage('avatar', 'Avatar')
    ->setPreviewPath(
        '/avatar/preview',
        __DIR__ . '/../public',
        __DIR__ . '/../public'
    )
    ->setAttribute('style', 'text-align:center')
    ->setMaxHeight(50)
    ->setMaxWidth(50);

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

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

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

$grid->addNumber('amount', 'Amount')
    ->setUnit('USD')
    ->setThousandsSeparator(',')
    ->setDecimals(2)
    ->setDecimalPoint('.');

$grid->addDate('last_login', 'Last login')
    ->setFormat('Y-m-d H:i:s');

echo $grid->render();

Demo

S AvatarName Surname E-mail Amount
    
JanWilsonjan.wilson@test.xx123.00 USD2014-09-03 13:15:22
    
AlbertaEricksonalberta.erickson@test.xx98,753.65 USD2014-08-06 13:37:17
    
AdaWellsada.wells@test.xx852.37 USD2014-08-12 11:25:16
    
EthelFigueroaethel.figueroa@test.xx45,695.99 USD2014-09-05 10:23:26
    
IanGoodwinian.goodwin@test.xx1,236.99 USD2014-09-04 12:26:19