在树枝中插入多个块js

时间:2018-02-15 11:02:48

标签: javascript symfony twig

我可以在我的树枝上插入多个块j吗? 我需要这样做,因为如果我在第一个图表上有一个空值,那么我有一个highcharts错误,所以我在每次调用图表后都想要输出javascript调用?

这可能吗?

喜欢这样:

{% block content %}
<div class="">
    <div class="page-title">
        <div class="title_left">
            <h3><i class="fa fa-university"></i> Home</h3>
        </div>
    </div>

    <div class="clearfix"></div>
    <div class="row" id="indexStat">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
                <div class="x_content">
                    <div id="partie_charts" >
                        <div id="part1">
                            <div id="cloumnchart" style="display:inline-block;width: 490px;height: 347px ;margin: 0 auto"></div>
                            {% block js %}
                                {{ chart(cloumnchart) }}
                            {% endblock %}
                            <div id="basicline"
                                 style="display:inline-block;width: 400px;height: 347px ;  margin: 0 auto"></div>
                            {% block js %}
                                {{ chart(basicline) }}
                            {% endblock %}
                        </div>
                        <div id="part2">
                            <p >Person</p>
                            <div id="containerper"
                                 style="display:inline-block;width: 450px;height: 251px ; margin: 0 auto"></div>
                            {% block js %}
                                {{ chart(containerper) }}
                            {% endblock %}
                        </div>

                        <div id="containerpie"
                             style="width: 340px;  height: 164px; margin: 0 auto;">
                        </div>
                        {% block js %}
                            {{ chart(containerpie) }}
                        {% endblock %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block js %}

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>

<script src="https://code.highcharts.com/highcharts-3d.js"></script>
{% endblock %}

0 个答案:

没有答案