1234567891011121314151617181920212223242526272829303132333435363738 |
- {% macro get_table(headers,rows,table_height,table_width,lock_column_count) %}
- <div style="overflow: auto;height: {{table_height}};width:{{table_width}};float: left;">
- <table class="table table-striped table-bordered table-hover" style="border:1px solid gray;">
- <thead>
- <tr>
- {% set _left = 0 %}
- {% for item in headers %}
- {% set name = item[0] %}
- {% set width = item[1] %}
- <th style="line-height: 30px;border: 1px solid #ddd;padding: unset;vertical-align: middle;text-align: center;
- {% if width %} width: {{width}}px;{% endif %}
- {% if lock_column_count and loop.index<=lock_column_count %}
- {% if loop.index>1 %}{% set _left = _left + headers[(loop.index-2)][1] %}{% endif %}
- left:{{_left}}px;z-index: 3;{% endif %}">{{name}}
- </th>
- {% endfor %}
- </tr>
- </thead>
- <tbody>
- {% for row in rows %}
- <tr>
- {% set _left = 0 %}
- {% for item in row %}
- <td
- {% if lock_column_count and loop.index<=lock_column_count %}
- {% if loop.index>1 %}{% set _left = _left + headers[(loop.index-2)][1] %}{% endif %}
- style="left:{{_left}}px;background-color:lightpink;z-index: 1;position: sticky;{{item[1]}}"
- {% endif %}
- {% if item[2] %} {{item[2]}} {% endif %}
- >{{item[0]}}
- </td>
- {% endfor %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- {% endmacro %}
|