首页 > 解决方案 > HTML表格很大时响应时间慢

问题描述

当行数很大时,我的 HTML 表需要更多时间来加载。我必须将近 50000 行表加载到网页中。我只是使用了基本的 HTML 表格。ASP.NET C#。

<div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">Available Resistors In Stock</h3>
                <!--
    <input type="text" class="form-control pull-right" id="task-table-filter" data-action="filter" data-filters="#task-table" placeholder="Filter Resistors" />
-->
            </div>
            <table class="table table-hover" id="task-table">
                <thead>
                    <tr>
                        <th class="center">#</th>
                        <th class="center">Resistor Type</th>
                        <th class="center">Resistor Value</th>
                        <th class="center">Ohm</th>
                        <th class="center">Location</th>
                        <th class="center">PL</th>
                        <th class="center">Place</th>
                        <th class="center">Category</th>
                        <th class="center">Quantity</th>
                        <th class="center">Part NO</th>
                        <th class="center">Description</th>
                        <th class="center">Active</th>
                        <th class="center">Edit</th>
                    </tr>
                </thead>
                <tbody>
                    @for (int i = 0; i < Model.Rows.Count; i++)
                    {
                        <tr class="center">
                            <td>@Model.Rows[i][0]</td>
                            <td>@Model.Rows[i][1]</td>
                            <td>@Model.Rows[i][2]</td>
                            <td>@Model.Rows[i][3]</td>
                            <td>@Model.Rows[i][4]</td>
                            <td>@Model.Rows[i][5]</td>
                            <td>@Model.Rows[i][6]</td>
                            <td>@Model.Rows[i][7]</td>
                            <td>@Model.Rows[i][8]</td>
                            <td>@Model.Rows[i][9]</td>
                            <td>@Model.Rows[i][10]</td>
                            <td>@Model.Rows[i][11]</td>
                            <td>
                                <a href="@Url.Action("StoreAddResistors", "Store",new {@id=@Model.Rows[i][0] } )">
                                    <span class="glyphicon glyphicon-refresh"></span>
                                </a>
                            </td>
                        </tr>
                     }
                </tbody>
            </table>
        </div>

有什么办法可以减少网页的加载时间?

标签: htmlasp.net-mvchtml-table

解决方案


尝试将页面分成几个。或者是否有可能以某种方式将多个 html 文档连接到 1 页?我没有更多的想法


推荐阅读