简体   繁体   English

我在 Java 脚本位中有来自谷歌表的数据如何进行搜索 function 并确保 50000 加载行

[英]I Have data from google sheet in Java script bit how to make search function and make sure the 50000 loads rows

I am look for script witch one able to search table from html google sheet.我正在寻找能够从 html 谷歌表中搜索表格的脚本女巫。 and if there is a lot of data it have to load data or split them.如果有很多数据,它必须加载数据或拆分它们。

<p class="font-weight-bold">The data in the table comes from the google spreadsheet</p>

<a class="btn btn-primary mb-4" href="https://docs.google.com/spreadsheets/d/1t2_HHLkibAybPORmXuDDEFEyetC3p7r1blQRpjzinXg/edit?usp=sharing" role="button" target="_blank">Click to see the source sheet</a>

<!-- Table  -->
<table class="table table bordered table-striped" id="testTable">
  <!-- Table head -->
  <thead>
    <tr>
      <th>Name</th>
      <th>Age</th>
      <th>E-mail</th>
    </tr>
  </thead>
  <!-- Table head -->

  <!-- Table body -->
  <tbody id="demo">


  </tbody>
  <!-- Table body -->
</table>
<!-- Table  -->

<script>
 $.getJSON("https://spreadsheets.google.com/feeds/list/1t2_HHLkibAybPORmXuDDEFEyetC3p7r1blQRpjzinXg/od6/public/values?alt=json", function (data) {

      var sheetData = data.feed.entry;

      var i;
      for (i = 0; i < sheetData.length; i++) {

        var name = data.feed.entry[i]['gsx$_cn6ca']['$t'];
        var age = data.feed.entry[i]['gsx$_cokwr']['$t'];
        var email = data.feed.entry[i]['gsx$_cpzh4']['$t'];

        document.getElementById('demo').innerHTML += ('<tr>'+'<td>'+name+'</td>'+'<td>'+age+'</td>'+'<td>'+email+'</td>'+'</tr>');

      }
    });

</script>

this result witch one i want manage to get: https://datatables.net/examples/ajax/defer_render.html这个结果女巫我想设法得到: https://datatables.net/examples/ajax/defer_render.html

You can add search, pagination, and sort for the table like this: $('TABLE ID').DataTable(); $('.dataTables_length').addClass('bs-select');您可以像这样为表添加搜索、分页和排序: $('TABLE ID').DataTable(); $('.dataTables_length').addClass('bs-select'); $('TABLE ID').DataTable(); $('.dataTables_length').addClass('bs-select');

Here is the example with Search Function这是搜索 Function 的示例

 $.getJSON("https://spreadsheets.google.com/feeds/list/1t2_HHLkibAybPORmXuDDEFEyetC3p7r1blQRpjzinXg/od6/public/values?alt=json", function (data) { var sheetData = data.feed.entry; var i; for (i = 0; i < sheetData.length; i++) { var name = data.feed.entry[i]['gsx$_cn6ca']['$t']; var age = data.feed.entry[i]['gsx$_cokwr']['$t']; var email = data.feed.entry[i]['gsx$_cpzh4']['$t']; document.getElementById('demo').innerHTML += ('<tr>'+'<td>'+name+'</td>'+'<td>'+age+'</td>'+'<td>'+email+'</td>'+'</tr>'); } $('#testTable').DataTable(); $('.dataTables_length').addClass('bs-select'); });
 <script src="https://code.jquery.com/jquery-3.5.0.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css"> <p class="font-weight-bold">The data in the table comes from the google spreadsheet</p> <a class="btn btn-primary mb-4" href="https://docs.google.com/spreadsheets/d/1t2_HHLkibAybPORmXuDDEFEyetC3p7r1blQRpjzinXg/edit?usp=sharing" role="button" target="_blank">Click to see the source sheet</a> <:-- Table --> <table id="testTable" class="table table bordered table-striped"> <.-- Table head --> <thead> <tr> <th>Name</th> <th>Age</th> <th>E-mail</th> </tr> </thead> <.-- Table head --> <.-- Table body --> <tbody id="demo"> </tbody> <.-- Table body --> </table> <.-- Table --> <script src="https.//cdn:datatables.net/1.10.20/js/jquery.dataTables.min.js"></script> <script src="https.//cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在谷歌脚本中自动删除具有多个工作表的行 - How to make automatically delete rows with multiple sheet in google script 如何确保即使用户离开页面也可以加载Google Analytics(分析)? - How to make sure Google Analytics loads even if user navigates away from page? 如何为 Google 工作表制作循环脚本? - How to make a loop script for Google sheet? 如何通过JavaScript制作Google内部网站搜索脚本 - how can i make a Google Internal Site Search Script by JavaScript 如何确保Google TTS的传入语音已完全加载? - How to make sure the incoming voice from Google tts have fully loaded? 使用 Google Apps 脚本,如何替换 Google 表格模板中的文本以制作新表格? - Using Google Apps Script, how can I replace text in a Google Sheets template to make a new Sheet? 如何使可点击的HTML文本加载<script>? - How do I make clickable HTML text that loads a <script>? 如何让我的脚本在 Google 表格的多个表格上运行? 我正在插入带有数据的行并需要它在多张纸上运行 - How can I make my script run on multiple sheets on Google Sheets ? I'm inserting rows with data and need it to run on multiple sheets 当特定单元格的值更改时,如何使Google表格脚本发送电子邮件? - How do I make a Google Sheet script send an email when a specific cell's value changes? 如何让我的脚本针对 Google 表格中的特定列? - How do I make my script target a specific column in Google Sheet?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM