好的,所以我试图使用jQuery DataTable(DataTables.net)显示来自我的数据库的信息.我可以让它工作得很好,显示整个表'笔记',但我想只显示未读取的笔记.所以我需要以某种方式包含一个WHERE子句,但我不清楚最好的方法来解决这个问题.
这是我目前显示整个表格的方式:
// DB table to use
$table = 'Notes';
// Table's primary key
$primaryKey = 'CID';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 'CID', 'dt' => 0 ),
array(
'db' => 'CID',
'dt' => 0,
'formatter' => function( …Run Code Online (Sandbox Code Playgroud) 我使用最小配置的jquery数据表来展示我网站上的数据.我有10K到50K的记录显示在数据表中.
目前,数据表大约需要60秒来初始化3000条记录.
有两个选项可用于初始化数据表: -
1)在页面上添加记录作为html表,然后在该表上初始化数据表.
2)拥有一个json记录,然后用该数据初始化datatable.
执行以下步骤有助于我们提高datatable插件的性能: -
1)减少列数
2)对相关列进行分组
3)仅对所需字段进行排序或一起删除排序功能
数据如下 - 这是一组mcq问题,带有预览/编辑/删除选项

搜索问题对我的应用程序非常重要.
请提供最佳解决方案,以便为所提供的数据集使用数据表.
看起来应该很容易但......
有谁知道如何从过滤后的dataTable返回当前行?该oTable.fnGetNodes()方法返回所有行,我只想要过滤(可见,但包括分页)
// filter on division
var oTable = $('#summary-table').dataTable();
oTable.fnFilter(division_text, 2, true);
// Get the nodes from the table
var nNodes = oTable.fnGetNodes(); // <-- still retrieves original list of rows
Run Code Online (Sandbox Code Playgroud)
我检查过:从Datatables中检索可见数据,但没有太多帮助.
如何在dataTable的单个单元格中添加多个json值.我正在阅读数据表文档,但无法得到一个明确的例子.
我有以下JSON字符串,我通过会话访问它到dataTable.
<textarea id="Report" type="text" style="" name="Report">
[
{
"Identifier": "0",
"LastName": "Cooper",
"FirstName": "Benny",
"MiddleInitial": "P",
"MRN": "7854753",
"Age": "30",
"Gender": "Female",
"Location":
{
"Bed": "1",
"Room": "A",
"unit": "NU1",
"facility": "Fac1"
},
"ServiceDate":"05/03/2013",
"ChargeAndDx":"99222 - 410.01,428",
"BillingProvider":"Palmer, James",
"title":"Add",
"start":"2013-08-07",
"url":"#",
"textColor":"red"
}] </textarea>
Run Code Online (Sandbox Code Playgroud)
在我访问数据表中的会话的另一个页面上有以下内容:
$(document).ready(function (){
var ReportData=JSON.parse(document.getElementById("Report").innerHTML);
Report=$('#patientDataTables').dataTable
({
"bJQueryUI":true,
"bScrollCollapse":true,
aaData:patientReportData,
"aoColumns":
[ {"mData":"LastName","sClass":"left"},
{"mData":"ServiceDate","sClass":"left"},
{"mData":"ChargeAndDx","sClass":"left"},
{"mData":"BillingProvider","sClass":"left"},
{"mData":"null","sClass":"center","sDefaultContent":"<a href='' class='editor_menu'>menu</a>"}
]
});
Run Code Online (Sandbox Code Playgroud)
在LastName出现的数据表中,我想要FirtName,Middle Initial,MRN和age.
怎么做 如果有人知道一个快速的方法来做到这一点.
问题:
创建数据表后,每列中的每个单元都应该有一个单击事件,该事件将打开一个弹出窗口并传入一个从端点接收的JSON名称列表.端点根据单击的表格单元格而变化.
我认为,在数据表实例化时,我需要在每个表格单元格元素上定义的HTML5数据属性中存储某种独特的信息.我希望声明一个自定义数据属性(例如:data-endpoint ="endpoint id"),但如果表行是通过DataTables动态生成的话,我可能不会这样做.
因为我不知道/不了解我的选择,所以我想描述一下我理想的做法:
我不明白的部分是如何在表格单元格元素上创建自定义数据属性.这是可能的还是我需要考虑另一种方法.任何帮助深表感谢!
我有HTML页面,它有多个复选框,可以单独检查.我有" 全选 " 按钮,当我点击此按钮时,所有复选框都应该被选中,当我再次点击同一个按钮时,所有复选框都应从所有页面中取消选中.
在我原来的程序中有成千上万的记录,但是一次有10条记录显示,但是当用户点击选择时它应该选择所有的千条记录.
我正在使用jQuery Datatables插件来显示数据.它提供分页,搜索,排序等,所以我一直只在当前页面上显示10条记录.如果我点击下一个或Bootstrap Datatable提供的页码,将显示另外10条记录.正如在问题中提到的,我想从所有页面中选择所有复选框.
$(document).ready(function () {
$('body').on('click', '#selectAll', function () {
if ($(this).hasClass('allChecked')) {
$('input[type="checkbox"]', '#example').prop('checked', false);
} else {
$('input[type="checkbox"]', '#example').prop('checked', true);
}
$(this).toggleClass('allChecked');
})
});Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>monitoring</title>
<script src="jquery.js"></script>
</head>
<body>
<table id="example" class="myclass">
<thead>
<tr>
<th>
<button type="button" id="selectAll" class="main">
<span class="sub"></span> Select </button></th>
<th>Name</th>
<th>Company</th>
<th>Employee Type</th>
<th>Address</th>
<th>Country</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox"/>
</td>
<td>varun</td>
<td>TCS</td>
<td>IT</td>
<td>San …Run Code Online (Sandbox Code Playgroud)我有下表:
<table id="example" class="stripe row-border order-column" cellspacing="0" width="100%">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>Extn.</th>
<th>E-mail</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger</td>
<td>Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
<td>5421</td>
<td>t.nixon@datatables.net</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
使用这个脚本,我可以向前滚动第二列,并First name修复第一列().
$(document).ready(function() {
var table = $('#example').DataTable( {
scrollY: "300px",
scrollX: true,
scrollCollapse: true,
paging: false
} );
new $.fn.dataTable.FixedColumns( table );
} );
Run Code Online (Sandbox Code Playgroud)
我想要做的是 手动交互式调整第一列的动态.我怎样才能做到这一点?

我不确定我是否重复这个问题,如果是正确的地方指导:)
我正在使用数据表并尝试实现水平滚动并找到此链接
http://www.datatables.net/examples/basic_init/scroll_x.html
我在我的数据表代码中使用了这些属性,并且在UI中遇到了问题.
我的数据得到了水平滚动条,但是我的列没有扩展而且没有按预期工作.我的正常列下面有一个额外的空列.
基本上我的UI搞砸了.我看到了同样的老线程讨论!
这些问题现在解决了吗?
================================
添加示例代码
$("#results").dataTable({
"aaData": [
//My data
],
"aoColumns": [
//My Columns
],
"bPaginate": true,
"bSort": true,
"bFilter": false,
"bJQueryUI": false,
"bProcessing": true,
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true
});
Run Code Online (Sandbox Code Playgroud) 使用jQuery DataTables时,是否可以在使用过滤器时进行不区分重音的搜索?例如,当我输入'e'字符时,我想用'e'或'é','è'搜索每个单词.
我想到的是将字符串规范化并将它们放入一个单独的隐藏列中,但这并不能解决字母顺序问题.
我尝试了以下方法:
$.fn.dataTableExt.ofnSearch = function ( data ) {
return ! data ?
'' :
typeof data === 'string' ?
data
.replace( /\n/g, ' ' )
.replace( /á/g, 'a' )
.replace( /é/g, 'e' )
.replace( /í/g, 'i' )
.replace( /ó/g, 'o' )
.replace( /ú/g, 'u' )
.replace( /ê/g, 'e' )
.replace( /î/g, 'i' )
.replace( /ô/g, 'o' )
.replace( /è/g, 'e' )
.replace( /ï/g, 'i' )
.replace( /ü/g, 'u' )
.replace( /ç/g, 'c' ) : …Run Code Online (Sandbox Code Playgroud) javascript jquery non-ascii-characters accent-insensitive jquery-datatables
我正在使用jQuery dataTable,当用户选择下拉列表时,它会搜索数据表并对其进行过滤,并根据搜索到的数据重新绘制内容:
mtTable.columns().each(function() {
mtTable.column(22).search(searchVal, true, true).draw();
});
Run Code Online (Sandbox Code Playgroud)
现在我尝试在搜索完成后获取所有列值,但是我找不到执行此操作的函数.目前我正在使用api
var myTable = $("#tblResults").DataTable();
var resultsArray = myTable.columns(colIndex).data();
Run Code Online (Sandbox Code Playgroud)
根据文档,这将返回未经过滤的列中的所有数据.我找不到一个函数来为我提供过滤数据的列值数组.
jquery ×10
html ×3
javascript ×3
datatables ×1
html5-data ×1
jquery-ui ×1
mysql ×1
php ×1
sql ×1