edweld / datatablesbundle

基于 Doctrine2 实体的 Symfony Datatable Bundle

安装: 19

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 237

开放问题: 0

类型:symfony-bundle

v0.11 2016-05-28 12:59 UTC

This package is not auto-updated.

Last update: 2024-09-18 19:44:24 UTC


README

SensioLabsInsight

knpbundles.com

Build Status

Latest Stable Version Total Downloads Latest Unstable Version License

近期更改

原地编辑回调 (#372)

$this->columnBuilder
    ->add('name', 'column', array(
        'title' => 'Name',
        'editable' => true,
        'editable_if' => function($row) {
            return (
                $this->authorizationChecker->isGranted('ROLE_USER') &&
                $row['public'] == true
            );
        }
    ))

流水线操作以减少 Ajax 调用

$this->ajax->set(array(
    'url' => $this->router->generate('chili_private_results'),
    'pipeline' => 6
));

搜索结果高亮显示。

  1. 包含jQuery Highlight 插件
  2. 配置 Datatables-Class 功能
$this->features->set(array(
    // ...
    'highlight' => true,
    'highlight_color' => 'red' // 'red' is the default value
));

使用 Featherlight 放大缩略图

#401

Bootstrap 模态窗口在响应式模式下不能正常工作。

在您的基布局中加载 Featherlight

add_if 闭包用于所有列和顶部操作

$this->columnBuilder
    ->add('title', 'column', array(
        // ...
        'add_if' => function() {
            return ($this->authorizationChecker->isGranted('ROLE_ADMIN'));
        },
    ))
;
$this->topActions->set(array(
    // ...
    'add_if' => function() {
        return ($this->authorizationChecker->isGranted('ROLE_ADMIN'));
    },
    'actions' => array(
        // ...
    )
));

渲染操作

之前

'actions' => array(
    array(
        'route' => 'post_edit',
        'route_parameters' => array(
            'id' => 'id'
        ),
        'role' => 'ROLE_ADMIN',
        'render_if' => function($row) {
            return ($row['title'] === 'Title 1');
        },
    ),
    // ...

之后

'actions' => array(
    array(
        'route' => 'post_edit',
        'route_parameters' => array(
            'id' => 'id'
        ),
        'render_if' => function($row) {
            return (
                $this->authorizationChecker->isGranted('ROLE_USER') &&
                $row['user']['username'] == $this->getUser()->getUsername()
            );
        },
    ),
    // ...

多选:如果条件为真才渲染复选框

$this->columnBuilder
    ->add('title', 'multiselect', array(
        // ...
        'render_checkbox_if' => function($row) {
            return ($row['public'] == true);
        },
    ))
;

屏幕截图

具有 Bootstrap3 集成的表格

Screenshot

文档

安装

列类型

原地编辑

如何使用 ColumnBuilder

设置 Datatable 类

过滤

使用行格式化器

查询回调

如按钮或响应式之类的扩展

生成器选项

参考配置

示例

演示应用

集成第三方内容

集成 Bootstrap3

集成 Doctrine 2 的可翻译行为扩展

集成 LiipImagineBundle / ImageColumn,GalleryColumn 和缩略图

限制和已知问题

和所有其他软件一样,《SgDatatablesBundle》并不完美,功能也不完整。

  • 此扩展不支持多个 ID。
  • 在虚拟列上搜索和过滤尚未实现,默认情况下已禁用。
  • 目前 PostgreSQL 完全不受支持。

报告问题或功能请求

问题和功能请求在Github 问题跟踪器中跟踪。

你必须知道,你将要提交的所有 pull 请求都必须在 MIT 许可下发布。

友好许可

此扩展受 MIT 许可证保护。请参阅扩展中的完整许可证。

Resources/meta/LICENSE

你可以自由使用、修改和分发此软件,只要保留版权头信息(特别是以 /* 开头的注释块)!