bootstrap DataTable 插件的使用

摘要:
--/. box body--˃$(function()){//获取id表$(“#resourcetable”)。DataTable({“bJQueryUI”:true,“oLanguage”:{//语言设置“sLengthMenu”:“每页显示_MENU_记录”,“sZeroRecords”:“抱歉,找不到”,“sInfo”:”从_START_到_END_/的总计_Total_数据“,”sInfoEmpty“:”无数据“,“sIInfoFiltered”:“(从_MAX_”,“s ZeroRecords“:”未检索到数据”,”sSearch“,”o想象“:{“sFirst”:“Home”,“sPPrevious”:“Previous”,“sNext”:“Next”,“s Last”:“Last”}});}));

//引入css和js文件 

<link rel="stylesheet" href="http://t.zoukankan.com/${ctx}/static/plugins/datatables/dataTables.bootstrap.css">

<script src="http://t.zoukankan.com/${ctx}/static/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="http://t.zoukankan.com/${ctx}/static/plugins/datatables/dataTables.bootstrap.min.js"></script>

//正文  保证table  thead tbody 等标签的完整性

<div style="overflow-x:hidden">  //下面过长的滚动条取消
<table id="resourcetable"> //通过id来确定分页查询的table
<thead>
<tr class="tabth">
<th>序号</th>
<th>上级菜单</th>
<th>目录类型</th>
<th>菜单名称</th>
<th>URL</th>
<th>说明</th>
<th style="padding-left: 20px;">操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${list}" var="list" varStatus="s">
<tr>
<td>${ s.index + 1}</td>
<td><c:if test="${list.parentresourcename==null}">根目录</c:if>
<c:if test="${list.parentresourcename!=null}">${list.parentresourcename}</c:if>
</td>
<td><c:if test="${list.sourcetype==1}">左侧菜单</c:if>
<c:if test="${list.sourcetype==2}">顶部菜单</c:if>
</td>
<td>${list.resourcename}</td>
<td>${list.url}</td>
<td>${list.memo}</td>
<td>
<a href="javascript:deleteresource(${list.id});"></a>
<a href="javascript:updateresource(${list.id});"></a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div><!-- /.box-body -->

$(function () {                                           //获取id的table
$('#resourcetable').DataTable({
"bJQueryUI": true,
"oLanguage": { // 语言设置
"sLengthMenu": "每页显示 _MENU_ 条记录",
"sZeroRecords": "抱歉, 没有找到",
"sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
"sInfoEmpty": "没有数据",
"sInfoFiltered": "(从 _MAX_ 条数据中检索)",
"sZeroRecords": "没有检索到数据",
"sSearch": "搜索:",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "前一页",
"sNext": "后一页",
"sLast": "尾页"
}
}
});
});

免责声明:文章转载自《bootstrap DataTable 插件的使用》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇树莓派wiringPi经常使用的函数介绍swift3.0 CoreGraphics绘图-实现画板下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

关于 angular 项目 结合 RequireJs 的问题整理

1、在 将 依赖的js 通过 require.config 设置 映射的时候,结合dataTables.bootstrap.js和 jquery.dataTables.js 时 遇到如下报错: Uncaught Error: Script error for "datatables.net", needed by: dataTablesbootstrap;...

Jquery DataTables 获取表格数据及行数据

注意table变量是 1.jQuery DataTables 行号获取 $("#example tbody tr").on("click", function() {var index = $(this).context._DT_RowIndex; //行号});   2.获取表格所有数据 function getTableContent(){     ...

DataTables warning : Requested unknown parameter '5' from the data source for row 0

在该项目中我使用了jquery.dataTables.js来作为我的前端数据表格。 表格的官网地址:https://www.datatables.net/ 一、jsp部分代码片段如下: 1 <table id="dynamic-table" 2 class="table tabl...

实现DataTables搜索框查询结果高亮显示

DataTables是封装好的HTML表格插件,丰富了HTML表格的样式,提供了即时搜索、分页等多种表格高级功能。用户可以编写很少的代码(甚至只是使用官方的示例代码),做出一个漂亮的表格以展示数据。关于DataTables的更多信息,请查看:http://www.datatables.club/、https://datatables.net/。下图将要展示...

DataTable 中的查询、排序及分页(c#)

public class GetDataTable        {            /// <summary>            /// 对sourceDt进行排序,并且可以自由设置显示的条数            /// --select top (num) from sourceDt order by strSort      ...