page.JumpToData()的问题 [英] Issues with page.JumpToData()
问题描述
我正在使用这个并在我的页面中有一个数据表。
我从其他网站页面接收值,根据它们我应该重绘表格。
我收到BookNo值,当表格加载时,我应该打开此BookNo所在的页面。 (如果它放在第2页或第3页,我应该打开那些页面。)
我发现这个并尝试使用它:
I am using this and have a datatable in my page.
I am receiving values from another site pages, and according to them I should redraw table.
I am receiving BookNo value, and when table is loaded, I should open page where this BookNo is placed. (If it is placed on page 2 or 3, I should open those page).
I found this and tried to use it:
jQuery.fn.dataTable.Api.register('page.jumpToData()', function (data, column) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false);
}
return this;
});
和:
and:
var dtApi = new $.fn.dataTable.Api("#Book_grid");
dtApi.page.jumpToData(selectedBookNo, 1);
什么都没有。它应该工作,但不,没有。当这个尝试设置var pos属性时,它总是返回-1。
根据链接,我希望打开搜索BookNo所在的propher页面。
我错过了什么,我做错了什么?
PS
我页面上有很多东西可以和
And nothing. Its supposed to work but, no. When this tries to set var pos property, it always returns -1.
According to links, I expected to open propher page where searched BookNo are placed.
What am I missing and what I am doing wrong?
P.S
I have many things on page which works with
$.fn.dataTable.Api("#Book_grid");
一起使用,我确信这个存在。
使用
and I'm sure that this exist.
With
var dtApi = $("#Book_grid").DataTable();
我得到了相同的结果。
推荐答案
.fn.dataTable.Api( #Book_grid);
dtApi.page.jumpToData(selectedBookNo, 1 );
.fn.dataTable.Api("#Book_grid"); dtApi.page.jumpToData(selectedBookNo, 1);
什么都没有。它应该工作,但不,没有。当这个尝试设置var pos属性时,它总是返回-1。
根据链接,我希望打开搜索BookNo所在的propher页面。
我错过了什么,我做错了什么?
PS
我页面上有很多东西可以用于
And nothing. Its supposed to work but, no. When this tries to set var pos property, it always returns -1.
According to links, I expected to open propher page where searched BookNo are placed.
What am I missing and what I am doing wrong?
P.S
I have many things on page which works with
.fn.dataTable.Api(#Book_grid);
.fn.dataTable.Api("#Book_grid");
我确定存在这种情况。
使用
and I'm sure that this exist.
With
var dtApi =
(#Book_grid)。DataTable();
("#Book_grid").DataTable();
我得到了相同的结果。
这篇关于page.JumpToData()的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!