【发布时间】:2019-12-11 05:29:20
【问题描述】:
我需要创建一个基于网络的资助表,重点关注可以按结果过滤和排序的护理访问。尽管我从未真正使用过 Javascript(很久以前使用过一点 HTML),但通过使用 Jquery DataTable 插件,我已经能够完成大部分目标。我想为我们的用户提供点击折叠按钮来查看摘要(通常是 1000 个字符)的选项,如果他们想查找更多详细信息。
我在 Stackoverflow 上已经有很长时间了,我知道它至少会进行一次尝试,而我也这样做了。可悲的是,我知道我走了。我很感谢这里的任何帮助,因为一旦我开始工作,我就完成了这个项目!
$(document).ready(function() {
$('#example').DataTable();
});
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>
<script src="http://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js">
</script>
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>Project Name</th>
<th>Project Number</th>
<th>PI(s)</th>
<th>End Date</th>
<th>Organization</th>
<th>Abstract</th>
</tr>
</thead>
<tbody>
<tr>
<td>Geographic Access to VHA Rehabilitation Services for OEF/OIF Veterans</td>
<td>DHI 06-010</td>
<td>Diane Cowper, Ph.D </td>
<td>9/30/2007</td>
<td>VA</td>
<td>
<button type="button" class="btn btn-info" data- toggle="collapse" data-target="#example">Simple collapsible</button>
<div id="demo" class="collapse">Abstract language example 2.</div>
</
</td>
<tr>
<td>Access to Specialty Dental Care - Racial Disparities</td>
<td>R01-234i482</td>
<td>John Summerton, MD</td>
<td>1/1/2020</td>
<td>AHRQ</td>
<td>
<button type="button" class="btn btn-info" data- toggle="collapse" data-target="#example">Simple collapsible</button>
<div id="demo" class="collapse">Abstract language example 1.</div>
</
</td>
</tr>
</tbody>
</table>
【问题讨论】:
标签: javascript jquery html html-table datatables