javascript - 可在表上选择的 JQuery
问题描述
我正在尝试在 Google Apps 脚本中的表上使用可选择的 jquery。我试图能够一次选择多个表行。我有它的工作,但现在它没有。任何帮助,将不胜感激!
<tbody>
添加元素时,我注意到了变化。我尝试以多种方式更改<style>
and 函数本身,但我似乎无法让它按预期工作。我查看了文档和其他一些问题,例如THIS和THIS,但我似乎无法使其工作
下面是我的整个Index.html
文件。我没有包含该Code.GS
文件。
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
#feedback { font-size: 1.4em; }
#table .ui-selecting { background: #FECA40; }
#table .ui-selected { background: #928bff; color: white; }
#table { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#table tr { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script>
$(function() {
google.script.run.withSuccessHandler(buildOptionsList)
.getTeamArray();
});
</script>
<script>
function buildOptionsList(array2) {
var table = document.getElementById('table');
var tableBody = document.createElement('tbody');
var tbodyID = tableBody.setAttribute('id','tbody');
array2.forEach(function(rowData) {
var row = document.createElement('tr');
rowData.forEach(function(cellData) {
var cell = document.createElement('td');
cell.appendChild(document.createTextNode(cellData));
row.appendChild(cell);
});
tableBody.appendChild(row);
});
table.appendChild(tableBody);
document.body.appendChild(table);
}
buildOptionsList(array2);
</script>
<script>
$(document).ready(function(){
$("#searchInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>
<script>
//need to edit something to get this working again.
$(function() {
$("#table").bind("mousedown", function(e) {
e.metaKey = true;
}).selectable({filter: 'tr'});
});
</script>
</head>
<body>
<div>TEST</div>
<input id="searchInput" value="Type To Search">
<table id="table">
<tr>
<th>GROUP</th>
<th>CLUB</th>
<th>TEAM</th>
<th>STATE</th>
</tr>
</table>
</body>
</html>
解决方案
我在这里找到了解决方案。我有冲突的 JQuery 版本。
推荐阅读
- apache-spark - 字数统计程序未在 spark 中产生所需的输出
- java - 有没有办法使用java更新jpg文件中的Exif标签?
- google-text-to-speech - 无法使用 Google texttoaudio API 设置凭据
- cygwin - 如何更改 /cygdrive/c 的所有权
- javascript - Keccak on react-native
- selenium - 从特定行中选择特定列值 - Java Selenium
- flutter - 使用来自另一个小部件的按钮插入 TextField - Flutter
- javascript - Nuxt.js i18n 本地化在 SPA 模式下不起作用
- c# - C# 性能分析器显示长时间暂停,无法从提供的数据中确定它是什么
- java - 仅使用线条和仿射变换来绘制多边形