默认情况下,数据表有4种大小的记录显示:10,25,50,100.
A)有没有办法改变这个?我尝试编辑jquery文件将数组更改为[30,60,90,120]本身,这就破坏了它.
B)有没有办法在jquery构建时初始化时将默认选择大小设置为此选择器的50(而不是10)?
我在文档中找不到这些项目.
是否可以在飞行中更改jQuery DataTables设置值.接下来我的问题是,我需要立即改变sAjaxSource
.已经尝试过这样的事情:
var oDefault = {
"bServerSide": true,
"bProcessing": true,
"bJQueryUI": true,
"bLengthChange": false,
"bFilter": true,
"iDisplayLength": 8,
"sAjaxSource": "my.php?" + "idKat="+aData[3],
"aaSorting": [[ 0, "asc" ],[ 3, "asc" ]],
"sDom": '<"top"ir>t<"bottom"pf<"clear">',
"sPaginationType": "full_numbers",
"oLanguage": {
"sUrl": "<?php echo $full_path_jezik_2;?>"
},
"aoColumns": [
{ "sName": "rb","sWidth": "15%", "sClass": "center","sType": "numeric" },
{ "sName": "chkZaBrisanje","sWidth": "20%", "sClass": "center", "bSortable":false },
{ "sName": "rbPrvaSlika","sWidth": "15%", "sClass": "center","bSortable":false },
{ "sName": "nazivSlike","sWidth": "50%", "sClass": "center", "sSortDataType": "dom-text" }
]
};
var …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用jQuery dataTable插件.问题是不显示排序图标(此箭头指向哪个方向数据实际排序).
我的代码如下:
$('#example').dataTable(
{
"bPaginate": false,
"bFilter": false,
"oLanguage": { "sInfo": ""}
}
);
Run Code Online (Sandbox Code Playgroud)
和Html:
<table class="surfClass" cellspacing="1" id="example">
<thead>
<tr>
<th width="120px">Name</th>
<th width="120px">The hourly rate (points)</th>
<th>Levels of referrals</th>
<th>bonuses</th>
<th width="70px">Payout minimum</th>
</tr>
</thead>
Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery和datatables.我想在特定行的TR元素中添加一个类.我知道如何找到这一行.所述console.dir(row);
显示row
对象和与一个启动tr
元件.我不能让jQuery选择器做任何事情.我错过了什么?
table = $('#resultTable').DataTable({
aaSorting: [],
ajax: {...},
columnDefs: [...],
createdRow: function (row, data, index) {
//
// if the second column cell is blank apply special formatting
//
if (data[1] == "") {
console.dir(row);
$('tr', row).addClass('label-warning');
}
}
});
Run Code Online (Sandbox Code Playgroud) 我使用Shiny的renderDataTable创建了一个包含一些HTML链接的表.但是,这些链接不是可点击的,而是按字面意思呈现:
https://samizdat.shinyapps.io/zakazky/
你知道什么是错的吗?在将Shiny升级到版本0.11之前它工作正常...谢谢!
我正在使用DataTables的服务器端实现,yadcf和select2用于增加功能.用于填充表的数据是通过对Django视图的Ajax请求获取的,select2自动完成功能的数据也是如此; 但是从一个单独的Django视图.
我的问题如下.如果搜索查询不返回结果,则select2搜索字段中的值将消失,并且无法在DataTable中重置 - 您必须改为刷新页面.非select2字段中的值仍然可见,可以重置.
有问题列中的过滤器类型multi_select
具有选择类型select2
.没有问题的列内过滤器类型range_date
和range_date
使用bootstrap-datetimepicker
作为日期选择器类型.
下面是我的select2列参数.
{
"column_number": 3,
"filter_type": "multi_select",
"select_type": "select2",
"select_type_options": {
dropdownCssClass : 'bigdrop',
multiple: true,
minimumInputLength: 1,
ajax: {
url: '{% url 'ffTestApp:searchData' 'product' %}',
delay: 250,
dataType: 'json',
data: function (params) {
return {
q: params.term,
v: yadcf.exGetColumnFilterVal(table,4),
s: yadcf.exGetColumnFilterVal(table,5)
};
},
processResults: function (data, params) {
params.page = params.page || 1;
return {
results: data.items
};
},
},
escapeMarkup: function (markup) { …
Run Code Online (Sandbox Code Playgroud) 我想使用数据数据表添加行,我可以这样做
var table = $('#mytable').DataTable();
table.add.row(['first column', 'second column', 'three column', 'etc']);
Run Code Online (Sandbox Code Playgroud)
我需要的是这样的东西(TR和TD标签中的一些属性)
<tr id="someID">
<td>first column</td>
<td>second column</td>
<td>three column</td>
<td id="otherID">etc</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我如何用数据表做到这一点?
我正在使用Datatables并在页面上有一个按钮,使用AJAX刷新表.要清楚表格没有使用ajax数据源,我们只是在需要时使用ajax来刷新它.Ajax正在刷新表所包含的div.我知道我正在丢失我的分页按钮和过滤功能,因为需要重新绘制表,但我不知道如何将其添加到表初始化代码中.
数据表代码
var oTable6;
$(document).ready(function() {
oTable6 = $('#rankings').dataTable( {
"sDom":'t<"bottom"filp><"clear">',
"bAutoWidth": false,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "bSortable": false, "sWidth": "10px" },
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]
});
});
Run Code Online (Sandbox Code Playgroud)
ajax代码是这样的
$("#ajaxchange").click(function(){
var campaign_id = $("#campaigns_id").val();
var fromDate = $("#from").val();
var toDate = $("#to").val();
var url = 'http://domain.com/account/campaign/ajaxrefreshgrid?format=html';
$.post(url, { campaignId: campaign_id, fromdate: fromDate, todate: toDate},
function( data ) {
$("#ajaxresponse").html(data);
});
});
Run Code Online (Sandbox Code Playgroud)
我尝试了这个,但它没有用
"fnDrawCallback": function() {
function( data ) { …
Run Code Online (Sandbox Code Playgroud) 一旦页面加载,是否可以将默认列设置为排序?我想对我网站上的不同表使用一个数据表调用.是否可以添加一个th
类来实现这一目标?
我也想在某些列上禁用排序,因为我正在寻找一个数据表调用来做所有事情,是否有一个类我可以添加到th将使它无法解决?
这是我所谓的dataTable脚本
if (jQuery().dataTable) {
$('#table-list-items').dataTable({
"fnDrawCallback" : function () {
},
"aLengthMenu": [
[10, 15, 25, 50, 100, -1],
[10, 15, 25, 50, 100, "All"]
],
"iDisplayLength": 25,
"oLanguage": {
"sLengthMenu": "_MENU_ Records per page",
"sInfo": "_START_ - _END_ of _TOTAL_",
"sInfoEmpty": "0 - 0 of 0",
"oPaginate": {
"sPrevious": "Prev",
"sNext": "Next"
}
},
"aoColumnDefs": [{
'bSortable': true,
'aTargets': [0]
}]
});
}
Run Code Online (Sandbox Code Playgroud) 我试图将列作为具有数据表的超链接,但没有成功.
function successCallback(responseObj){
$(document).ready(function() {
$('#example').dataTable( {
"data":responseObj ,
"bDestroy": true,
"deferRender": true ,
"columns": [
{ "data": "infomation" },
{ "data": "weblink" },
]
} );
} );
Run Code Online (Sandbox Code Playgroud)
}
我需要weblink来显示链接并成为该列中的超链接,以便用户可以单击并重定向到另一个页面.我查看了渲染,但链接上的信息较少,我无法成功.
我也研究了这个例子,但它没有用.
datatables ×10
jquery ×8
javascript ×2
ajax ×1
django ×1
numbers ×1
r ×1
rows ×1
shiny ×1
yadcf ×1