问题描述
我正在使用在grails应用程序中
这是我的初始化代码:
< g:javascript>
$(document).ready(function(){
var oTable = $('#projectTable')。dataTable({
bSort:false,
sPaginationType :
oTable.columnFilter({
sPlaceHolder:head:before,
aColumns:[
{sSelector: #projectIdFilter},
{sSelector:#projectNameFilter},
{sSelector:#projectStatusFilter,type:select},
{sSelector:#projectModifiedFilter} ,
{sSelector:#projectActionablesFilter}
]
});
});
function resetFilters(){
var oTable = $('#projectTable')。dataTable();
var oSettings = oTable.fnSettings();
for(iCol = 0; iCol< oSettings.aoPreSearchCols.length; iCol ++){
oSettings.aoPreSearchCols [iCol] .sSearch ='';
}
oTable.fnDraw();
$('#filter_Name')。val('');
$('#filter_Project_ID')。val('');
$('#filter_Modified')。val('');
$('#filter_Status')。val('Status');
$('#filter_Actionables')。val('');
}
< / g:javascript>
我的测试数据覆盖了30个数据行并且工作得很好(过滤,清除过滤器等等)唯一的问题是,分页不会显示出来。
如您所见: 在后台工作(显示1-1中有30个
)
我已经尝试了很多不同的pagingType,bPaginate,bSort,...东西,但似乎没有任何工作。
有什么想法?问题与底层grails应用程序?
小插件问题/信息:如果我删除 bSort:false
分页符中断完全和所有项目列出(1到30)在一个页面上。
我找到了解决方案 - 两种不同的混合jQuery的版本之一由aui(atlassian用户界面)自动包含,另一个由我手动包含。
解决方案因此:
< script type =text / javascriptcharset =utf8src =// code.jquery.com/jquery-1.10.2.min.js\"></script>
i am working with http://datatables.net/ within a grails applicationthis is my initialization code:
<g:javascript>
$(document).ready(function () {
var oTable = $('#projectTable').dataTable({
"bSort": false,
"sPaginationType": "full_numbers"
});
oTable.columnFilter({
sPlaceHolder: "head:before",
aoColumns: [
{ sSelector: "#projectIdFilter" },
{ sSelector: "#projectNameFilter" },
{ sSelector: "#projectStatusFilter", type: "select" },
{ sSelector: "#projectModifiedFilter"},
{ sSelector: "#projectActionablesFilter" }
]
});
});
function resetFilters() {
var oTable = $('#projectTable').dataTable();
var oSettings = oTable.fnSettings();
for(iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) {
oSettings.aoPreSearchCols[iCol].sSearch = '';
}
oTable.fnDraw();
$('#filter_Name').val('');
$('#filter_Project_ID').val('');
$('#filter_Modified').val('');
$('#filter_Status').val('Status');
$('#filter_Actionables').val('');
}
</g:javascript>
my testdata covers 30 data rows and works just fine (filtering, clearing filters, etc...) the only issue is, that the pagination will not show up.
as you see:
- pagination is working in the background (
showing 1-1 of 30
) - First text is appearing, although not clickeable (as currently on first page)
i have tried a lot of different pagingType, bPaginate, bSort,... things but nothing seems to work.
Any ideas? issues with the underlying grails application?
Small addon issue/information: if i remove bSort: false
the pagination breaks completely and all projects are listed (1 through 30) on one page.
I found the solution - a mixup of two different jquery versions one included automatically by aui (atlassian user interface) and another manually by me. the wrong one was chosen in the end and led to missing pagination.
solution therefore:
<script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
这篇关于jquery dataTable分页不出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!