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);
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();
I got the same result.