Bootstrap导出选项适用于5000行,但在16000行时由于网络故障而失败。

16

以下是具有5,000条记录的HTML。导出功能完全正常。但是,当记录增加到16,000时,所有导出都会显示网络故障。在控制台中未发现错误。我不确定原因。已在Chrome中进行了测试。

<html>

<head>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
  <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.css" rel="stylesheet" />

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/extensions/export/bootstrap-table-export.min.js"></script>
</head>

<body>
  <table data-toggle="table" data-search="true" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-show-export="true" data-minimum-count-columns="2" data-show-pagination-switch="true" data-pagination="true" data-id-field="id"
    data-page-list="[10, 25, 50, 100, ALL]" data-show-footer="false" data-side-pagination="client" data-url="https://jsonplaceholder.typicode.com/photos">
    <thead>
      <tr>
        <th data-field="id">Id</th>
        <th data-field="title">Title</th>
        <th data-field="url">URL</th>
        <th data-field="thumbnailUrl">Thumbnail URL</th>
      </tr>
    </thead>
</body>

</html>

拥有 > 15,000 条记录

<html>

<head>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
  <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.css" rel="stylesheet" />

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/extensions/export/bootstrap-table-export.min.js"></script>
</head>

<body>
  <table data-toggle="table" data-search="true" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-show-export="true" data-minimum-count-columns="2" data-show-pagination-switch="true" data-pagination="true" data-id-field="id"
    data-page-list="[10, 25, 50, 100, ALL]" data-show-footer="false" data-side-pagination="client" data-url="https://fd-files-production.s3.amazonaws.com/226483/16h4Vwxe1Wz9PZ5Gublomg?X-Amz-Expires=300&X-Amz-Date=20170906T130107Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIA2QBI5WP5HA3ZEA/20170906/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=5d705bfd19579c8a93ff81ee076363b2f36d1f5e4540b85f7c86de7643c17055">
    <thead>
      <tr>
        <th data-field="id">Id</th>
        <th data-field="title">Title</th>
        <th data-field="url">URL</th>
        <th data-field="thumbnailUrl">Thumbnail URL</th>
      </tr>
    </thead>
</body>

</html>


请查看以下链接:https://dev59.com/xXjZa4cB1Zd3GeqPZAdO - RaJesh RiJo
2
我在Chrome和Firefox上看到了这个问题,但似乎一切正常。无法复现该问题。 - TheChetan
2
@Kathir,重现问题的条件由提供,而不是读者填补空白。 - Louis
2
@Kathir,你的超过15,000个示例的服务器响应403(禁止)状态码。 - Louis
显示剩余11条评论
2个回答

2

尝试以下操作:

1.) 下载库文件而不是使用CDN。

2.) 在AWS服务器上增加页面超时时间。有可能您没有足够的时间来处理所有这些记录。

3.) 可能您遇到了某些未知的客户端限制,例如javascript.options.mem.max为128MB。(16k条记录可能会达到该限制。)

4.) 尝试另一个服务器。 AWS上可能存在您无法控制的限制(例如内存或连接的“生存时间”),但如果您为测试设置自己的个人专用服务器,则可以排除此限制。

5.) 禁用“ALL”选项。您真的想让人们一次拉取16k条记录吗?

6.) 作为最后的手段,请尝试制作一个服务器端分页脚本。


1
这似乎是S3请求过期的问题:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
   <Code>AccessDenied</Code>
   <Message>Request has expired</Message>
   <X-Amz-Expires>300</X-Amz-Expires>
   <Expires>2017-09-06T13:06:07Z</Expires>
   <ServerTime>2018-06-02T00:00:15Z</ServerTime>
   <RequestId>396C37F87B33C933</RequestId>
   <HostId>pg4uY75WW5p07yvAtqhEFvvKi0FreyHlNo/gJ329aRYHP9/KgzkVxRVkH4lZkwPtw7bLET+HPl8=</HostId>
</Error>

那看起来很有道理。如果有15k条记录,300ms的超时肯定会被触发。 - Ryan Battistone

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接