我无法解决崩溃我桌子某些行的问题。
你能建议我如何纠正它,这样我就可以折叠用红色标记的行?
我想我已将崩溃标签放在错误的地方或者没有再使用过?但是我可以在表中使用表吗?
我的模板:
{% extends "base.html" %}
{% block content %}
<h3><a href="">{% for project in projects %}{{ project.project_name }}{% endfor %}</a></h3>
<table class="table table-striped table table-bordered table table-hover table table-condensed">
<tr>
<td></td>
<!-- row with zone names -->
{% for z in zones %}
<td style="width:40px" align="center">{{ z.zone_name }}</td>
{% endfor %}
</tr>
<!-- rows with stage names -->
{% for trstage in trstages %}
<tr>
<td style="width:40px"><a data-toggle="collapse" href="#collapse{{ trstage }}">{{ trstage.stage_name }}</a></td>
<!-- row with stage value -->
{% for stage in trstage.stages %}
{% for zone in zones|dictsort:"zone_name" %}
{% if zone == stage.zone %}
<td style="width:40px" align="center">{{ stage.substage_sum.sum }}</td>
{% endif %}
{% endfor %}
{% endfor %}
</tr>
<div id="collapse{{ trstage }}" class="panel-collapse collapse">
<!-- rows with substages names -->
{% for trsubstage in trstage.related_trsubstages %}
<tr>
<td>{{ trsubstage.substage_name }}</td>
<!-- row with substage value -->
{% for substage in trsubstage.substages_related %}
{% for zone in zones %}
{% if zone == substage.stage.zone %}
<td style="width:40px" align="center">{{ substage.substage_value }}</td>
{% endif %}
{% endfor %}
{% endfor %}
</tr>
{% endfor %}
</div>
{% endfor %}
</table>
{% endblock %}
答案 0 :(得分:0)
尝试将trstage的id添加到div的href和id中。我在我的项目中做了类似的事情并且有效。我希望它对你也有用。像这样,
<div id="{{ trstage.id.value }}" class="panel-collapse collapse">
和
<a data-toggle="collapse" href="#{{ trstage.id.value }}">{{ trstage.stage_name }}