«Не найдено ни одной подходящей записи» с таблицей Bootstrap более 100 тысяч записей - PullRequest
0 голосов
/ 09 января 2019

My Bootstrap Table отлично работает, когда набор результатов меньше 100 тыс. Записей. Тем не менее, когда он превышает эту сумму, я всегда получаю ошибку «No Matching Records Found».

Я думаю, что это просто ограничение для этой структуры, но могу ли я что-нибудь сделать, чтобы это исправить? Или есть другой плагин, который я могу использовать с BT, который поможет мне вернуть все нужные мне записи?

Вот мой код для рассматриваемой таблицы:

<script>
  function getCustomerCount() {
  $(document).ready(function(){
      var alertDiv = $('#fresh-alert');
      var upgradeDiv = $('#fresh-alert-upgrade');
        $.ajax({
          url: "/customers/customer_count",
          data: {},
          type: "GET",
          dataType: "json",
          complete: function(data) {
            console.log(data)
            if(!data.responseJSON.ready){
              setTimeout(getCustomerCount, 3000);
              $('#fresh-table').bootstrapTable('refresh', {silent: true});
              alertDiv.removeClass('hidden');
            }
            if(data.responseJSON.ready == "upgrade"){
              $('#fresh-table').bootstrapTable('refresh', {silent: true});
              upgradeDiv.removeClass('hidden');              
            }
            if(data.responseJSON.ready){
              alertDiv.addClass('hidden');
              $('#fresh-table').bootstrapTable('refresh', {silent: true});              
            }
          },
        }); // ajax
  }); // document ready
}

getCustomerCount();
</script>

<div class="container-fluid top-pad bottom-pad">

    <div id="fresh-alert" class="alert alert-success alert-dismissible hidden" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <strong>Wow! You have a lot of customers.</strong> Give us just a minute and we'll get the rest.
    </div>

    <div id="fresh-alert-upgrade" class="alert alert-danger alert-dismissible hidden" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <strong>Snap!</strong> You have more customers than your subscription allows. Upgrade by clicking the big green question mark above and to your right.
    </div>

<body data-no-turbolink>
<div id="toolbar">
    <div class="form-inline" role="form">
        <div class="input-group">
          <div class="input-group-addon"><%= @currency %></div>
          <input type="number" step=".01" class="form-control" id="fresh-credit-update-amount" placeholder="amount to apply">
        </div>
        <button id="fresh-credit-apply-changes" type="submit" class="btn btn-default">Apply to Selected</button>
    </div>
</div>
<table id="fresh-table" data-toggle="table"
       data-search="true"
       data-show-refresh="true"
       data-show-columns="true"
       data-side-pagination="server"
       data-pagination="true"
       data-page-size=20
       data-height=500
       data-side-pagination="server"
       data-page-list="[5, 20, 50, 100, 200]"
       data-toolbar="#toolbar"
       data-maintain-selected="true"
       data-striped="true"
       data-url="<%= get_customer_data_path %>"
       data-cache="false"
       data-id-field="id"
       data-click-to-select="true"
       data-unique-id="id"
       data-editable-url="<%= customers_update_path %>"
       data-custom-search="customSearchFunction"
       data-sort-name="name">
  <thead>
  <tr>
    <th data-field="state" data-checkbox="true"></th>
    <th data-sortable="true" data-halign="center" data-align="center" data-field="name">Name</th>
    <th data-sortable="true" data-type="text" pk="1" data-halign="center" data-align="center" data-editable="true" data-resource="post" data-field="credit_amount">Credit Amount</th>
    <th data-sortable="true" data-title-tooltip="Pending credit is the amount of credit your customer has used on an order that has yet to be fulfilled" data-field="pending_credit_amount" data-halign="center" data-align="center" >Pending Credit</th>
    <th data-sortable="true" data-field="email" data-halign="center" data-align="center" >Email</th>
    <th data-sortable="true" data-field="accepts_marketing" data-halign="center" data-align="center" >Accepts Marketing</th>
    <th data-sortable="true" data-field="customer_status" data-halign="center" data-align="center" >Enabled</th>
    <th data-sortable="true" data-field="tags" data-halign="center" data-align="center" >Tags</th>  
  </tr>
  </thead>

</table>
</body>
</div>
...