dev-master
9999999-dev https://github.com/hashstudio/Mindy_Table
MIT
The Requires
- php >=5.4
- hindy/helper 0.*
by Anton Okulov
0.2.3
0.2.3.0 https://github.com/hashstudio/Mindy_Table
MIT
The Requires
- php >=5.4
- hindy/helper 0.*
by Anton Okulov
Wallogit.com
2017 © Pedro Peláez
Репозиторий является клоном django-tables2 на php., (*1)
<?php
namespace Modules\Example\Tables;
use Mindy\Table\Columns\RawColumn;
use Mindy\Table\Table;
use Modules\Example\ExampleModule;
class ExampleDataTable extends Table
{
public function getColumns()
{
return [
'created_at' => [
'class' => RawColumn::className(),
'title' => CoreModule::t('Created at')
],
'message' => [
'class' => RawColumn::className(),
'title' => CoreModule::t('Message')
],
'ip' => [
'class' => RawColumn::className(),
'title' => CoreModule::t('Ip')
],
'username',
'url'
];
}
}
Использование в контроллере:, (*2)
...
public function actionIndex()
{
$qs = ExampleData::objects();
$table = new ExampleDataTable($qs, [
'paginationConfig' => [
'pageSize' => 20
]
]);
echo $this->render('example/index.html', [
'table' => $table
]);
}
...
Шаблон:
```twig
{{ table|safe }} или {{ table.render()|safe }}
В текущей версии реализовано только 3 класса Column:, (*3)
TemplateColumn - Пример использования:...
'foo' => [
'class' => '\Mindy\Table\Columns\TemplateColumn',
'template' => 'my_app/my_template.html',
'title' => 'Super title'
]
...
Аргументы передаваемые в шаблон:, (*4)
...
'value' => $value, // Значение
'record' => $record, // Модель
'table' => $table // Таблица
...
NumberColumn - Пример использования:...
'foo' => [
'class' => '\Mindy\Table\Columns\NumberColumn',
'decimals' => 2,
'decPoint' => '.',
'thousandsSep' => ',',
'title' => 'Super title'
]
...
RawColumn - Пример использования:...
'foo' => [
'class' => '\Mindy\Table\Columns\RawColumn',
'title' => 'Super title'
]
...
MIT
MIT