Python 阅读烧瓶表中1列中的更多按钮

Python 阅读烧瓶表中1列中的更多按钮,python,mysql,flask,Python,Mysql,Flask,我想在我的表格中实现“阅读更多”和“不显示”按钮。我使用的是Flask,我的表连接到MySQL数据库,所以行数总是不同的,这就是为什么我不能硬编码它 我想在名为“description”的列中的每一行多读/少显示。如果“描述”列中的高度大于3rem,则显示较少按钮应在其单元格中可见,50px后的内容应隐藏。如果用户单击“阅读更多”按钮,则将显示整个内容 <div class="container-fluid mx-auto pt-4"> <tabl

我想在我的表格中实现“阅读更多”和“不显示”按钮。我使用的是Flask,我的表连接到MySQL数据库,所以行数总是不同的,这就是为什么我不能硬编码它

我想在名为“description”的列中的每一行多读/少显示。如果“描述”列中的高度大于3rem,则显示较少按钮应在其单元格中可见,50px后的内容应隐藏。如果用户单击“阅读更多”按钮,则将显示整个内容

<div class="container-fluid mx-auto pt-4">
     <table class="table table-striped table-bordered" id="TableToExport" cellspacing="0">
        <thead>
        <tr>
            <th>col1</th>
            <th>col2</th>
            <th>col3</th>
            <th>description</th>
            <th>col5</th>
        </tr>
        </thead>

        <tbody>
            {% for item in data %}
                <tr>
                    <td>{{item[0]}}</td>
                    <td>{{item[1]}}</td>
                    <td>{{item[2]}}</td>
                    <td>{{item[3]}}</td>
                    <td>{{item[4]}}</td>
                </tr>

            {% endfor %}
     </table>
    </div>
</div>

可乐
可乐
可乐
描述
可乐
{数据%中的项的%1}
{{item[0]}
{{项目[1]}
{{项目[2]}
{{项目[3]}
{{项目[4]}
{%endfor%}