ekyna/table-bundle
Composer 安装命令:
composer require ekyna/table-bundle
包简介
Table component integration
README 文档
README
Table component integration.
Instation
- Through Composer
composer require ekyna/table-bundle:0.1.*@dev
- Register the bundle in your AppKernel
// app/AppKernel.php public function registerBundles() { $bundles = array( // other bundles ... new Ekyna\Bundle\TableBundle\EkynaTableBundle(), ); return $bundles; }
Usage
- Create the table type
// src/Acme/DemoBundle/Table/Type/BrandType.php namespace Acme\DemoBundle\Table\Type; use Ekyna\Component\Table\AbstractTableType; use Ekyna\Component\Table\TableBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class BrandType extends AbstractTableType { public function buildTable(TableBuilderInterface $tableBuilder) { $tableBuilder ->addColumn('id', 'number', array( 'sortable' => true, )) ->addColumn('title', 'text', array( 'label' => 'Title', 'sortable' => true, )) ->addFilter('id', 'number') ->addFilter('title', 'text', array( 'label' => 'Title' )) ; } public function setDefaultOptions(OptionsResolverInterface $resolver) { parent::setDefaultOptions($resolver); $resolver->setDefaults(array( 'data_class' => 'Acme\DemoBundle\Entity\Brand', )); } public function getName() { return 'acme_demo_brand'; } }
- (optional) Register the table type as a service
<!-- src/Acme/DemoBundle/Resources/config/services.xml --> <service id="acme_demo.table_type.brand" class="Acme\DemoBundle\Table\Type\BrandType"> <tag name="table.type" alias="acme_demo_brand" /> </service>
- Create the controller
// src/Acme/DemoBundle/Controller/BrandController.php namespace Acme\Demo\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; // use Acme\DemoBundle\Table\Type\BrandType; class ResourceController extends Controller { public function indexAction(Request $request) { $table = $this->get('table.factory') /*->createBuilder(new BrandType(), array( // instance 'name' => 'my_brand_list, ))*/ ->createBuilder('acme_demo_brand', array( // service 'name' => 'my_brand_list', )) ->getTable($request) ; return $this->render('AcmeDemoBundle:Brand:index.html.twig', array( 'brands' => $table->createView(), )); } }
- Create the twig template
# src/Acme/DemoBundle/Resources/views/Brand/index.html.twig
<!DOCTYPE html>
<html>
<head>
{% stylesheets output='css/main.css'
'css/bootstrap.css'
'@EkynaTableBundle/Resources/asset/css/table.css'
-%}
<link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
{% endstylesheets %}
</head>
<body>
{{ ekyna_table_render(brands) }}
{% javascripts output='js/main.js'
'js/jquery.js'
'js/bootstrap.js'
'@EkynaTableBundle/Resources/asset/js/table.js'
-%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{%- endjavascripts %}
</body>
</html>
Customization
The default template used to render the table is vendor/ekyna/table-bundle/Ekyna/Bundle/TableBundle/Resources/views/ekyna_table.html.twig.
It requires jQuery and Bootstrap 3.
You can create your own rendering template (where you will define all blocks of the default template) and use it this way
{{ ekyna_table_render(brands, {'template': 'AcmeDemoBundle:Table:render.html.twig'}) }}
TODO
- Tests
- Type inheritance
- AJAX
- Adapters (ORM, ODM, PHPCR)
- Render engines
- More documentation (columns, filter, internals, ...)
ekyna/table-bundle 适用场景与选型建议
ekyna/table-bundle 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 1.51k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 03 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Symfony2」 「bundle」 「table」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ekyna/table-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ekyna/table-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ekyna/table-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Plug-ins for DataTables
A component that allows creating responsive HTML tables or lists from data object
2lenet/EasyAdminPlusBundle
The bundle for easy using json-rpc api on your project
Adjacency List’ed Closure Table database design pattern implementation for Laravel. Includes restore of tree
Provide a way to secure accesses to all routes of an symfony application.
统计信息
- 总下载量: 1.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-03-25