Rendering

Usage

Basic rendering

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

//! do something on $grid

$grid->render();

Extended rendering

Info Best way for MVC applications
Info This will fix setting headers in export before headers are send

In controller

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

//! do something on $grid

$this->template->gridRenderer = $grid->create();

In template

$gridRenderer->render();

Custom rendering

Danger If you use in-line filter, it must also render filter

In controller

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

//! do something on $grid

$this->template->gridRenderer = $grid->create();

In template

echo '< div ' . $gridRenderer->getWrapper()->attributes() . '>';

$gridRenderer->renderFilter();

$gridRenderer->renderGrid();

$gridRenderer->renderSelection();

$gridRenderer->renderExport();

$gridRenderer->renderPager();

echo '< /div >';

Class Mesour\DataGrid\Renderer\GridRenderer

Info Only important methods for rendering
Method Parameters Description
getWrapper none Grid wrapper. Returns Mesour\Components\Html
renderGrid none Render grid component
renderPager none Render pager component
renderSelection none Render selection component
renderExport none Render export component
render none Render the entire grid
__toString none Render the entire grid