jQuery DataTables - Slow initiation, “Normal” html table shown in the beginning

后端 未结 10 1425
旧时难觅i
旧时难觅i 2021-02-03 22:01

I\'m using jQuery DataTable plugin, but I got a concern where the scripts loading seems to take some time, so my web page is always displaying the ordinary html table first, and

10条回答
  •  Happy的楠姐
    2021-02-03 23:03

    Based on @hanzolo suggestion - here's my comment as an answer (and what my dataTable looks like):

    var stockableTable = $('#stockable').dataTable({
          "bLengthChange": false,
          "iDisplayLength": -1,
          "bSort": false,
          "bFilter": false,
          "bServerSide": false,
          "bProcessing": false,
          "sScrollY": "500px",
          "sScrollX": "95%",
          "bScrollCollapse": true,
          // The following reduces the page load time by reducing the reflows the browser is invoking
          "fnPreDrawCallback":function(){
              $("#loading").show();
          },
          "fnDrawCallback":function(){
          },
          "fnInitComplete":function(){
              $("#details").show();
              this.fnAdjustColumnSizing();
              $("#loading").hide();
          }
      });
    

提交回复
热议问题