首页 > 解决方案 > 有没有办法修改数据表,比如过滤信息?

问题描述

实际上我有一个 html.twig 文件,其中有下一个数据表:

--------------------------------------------------
审计 | 领域  
--------------------------------------
     1 | 区域
     1 2 | 区域
     1 3 | 区域
     1 4 | 区域
     1 5 | 区域
     2 6 | 2区
     7 | 2区
     8 | Area2
--------------------------------------
当前数据表的屏幕截图
但是我想要什么要做的就是以这种方式显示数据表:
--------------------------------------
Audits | 地区  
--------------------------------------
1, 2, 3, 4 | 区域
1 5, 6, 7, 8 |
区域2 --------------------------------------

这就是我在控制器中获取信息的方式:

$em = $this->getDoctrine()->getEntityManager();

        $auditsByAuditor = $em->getRepository('FSABundle:FsaAudits')
                            ->findBy(array('idAuditor'=>$auditor->getId()));


        return $this->render('FSABundle:FsaAudits:FsaPlan.html.twig', array(
            'currentPlan' => $currentPlan,
            'auditsByAuditor' => $auditsByAuditor
        ));

这就是我拥有html.twig 的方式:

<div class="table-responsive">
                <br/>
                {% for message in app.session.flashbag().get('status') %}
                    <div class="alert alert-success">{{message}}</div>
                    {%endfor%}
                    <table aria-describedby="dataTable_info" cellspacing="0" class="table table-hover dataTable" id="dataTable" role="grid" style="width:100%;" width="100%">
                        <thead>
                            <tr>
                                <th>Auditorias</th>
                                <th>Areas</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for audit in auditsByAuditor %}
                                <tr>
                                    <td>{{ audit.idAudit }}</td>
                                    <td>{{ audit.idArea}}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>


关于如何制作它的任何想法或建议?

标签: phpdatatabledatatablesdoctrinesymfony-2.8

解决方案


推荐阅读