Created
May 9, 2014 10:47
-
-
Save yankchina/c078da664bd7fc1e1aaa to your computer and use it in GitHub Desktop.
Jinja中创建 rowspan 的样例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block title %}{{report.title}}{% endblock %} | |
{% block titledemo %}{{report.demo_string}}{% endblock %} | |
{% block content %} | |
<div class="table-responsive" id="report"> | |
<table class='table table-striped'> | |
<thead> | |
{% for item in report.columes %} | |
<th>{{item}}</th> | |
{% endfor %} | |
</thead> | |
<tbody> | |
{% for teacher in report.teachers %} | |
{% set idx = 0 %} | |
{% for item in teacher.items: %} | |
{% set idx = idx + 1 %} | |
<tr> | |
{% if idx == 1 %} | |
<td rowspan="{{teacher.row_max_number}}">{{teacher.teacher_name}}({{teacher.teacher_code}})</td> | |
{% endif %} | |
<td>{{item.xnxq}}<td>{{item.df}}</td><td>{{item.pm}}</tr> | |
{% endfor %} | |
{% endfor %} | |
</table> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
虽然比较丑,但还是很有用!