Table of contents

Templates

Extending

When you set custom datagrid template, you will probably want to extend it. There are some blocks defined, so you can extend just some blocks. Presenter:

$grid->setTemplateFile(__DIR__ . '/../../custom_datagrid_template.latte');
1

Template:

{extends $originalTemplate}

{block data}
	{foreach $items as $item}
		{foreach $columns as $key => $column}
			{$column->render($item)}
		{/foreach}
	{/foreach}


{* Another latte code... *}
1
2
3
4
5
6
7
8
9
10
11

Column definition

Or you can define column template by defining special block(s):

{extends $originalTemplate}

{define col-id}
	:)
{/define}

1
2
3
4
5
6

This will overwrite native rendering of ID column ($grid->addColumn('id', 'Id');).

Column header definition

Or you can define column header template:

{extends $originalTemplate}

{define col-id-header}
	This is <strong>ID</strong> column
{/define}

1
2
3
4
5
6

Table class definition

By default, table has this class: table table-hover table-striped table-bordered. You can change that in {block #table-class}:

{block table-class}table table-hovertable-condensed table-bordered
1

Icons definition

Some icons are also surrounded by `{block icon-*}` macro. You can overwrite these blocks with your icons. The blocks are:

{block icon-sort}{/}
{block icon-sort-up}{/}
{block icon-sort-down}{/}
{block icon-caret-down}{/}
{block icon-chevron}{/}
1
2
3
4
5