问题描述
我正在使用 Tabulator,我需要添加将您带到所需页面的输入框.如果您有 10 页并且想要转到第 9 页,则只需输入 9 并按 Enter.此功能在数据表中可用,这里是一个示例那么如何用 Tabulator 做到这一点呢?谢谢
I am using Tabulator, I need to add input box that takes you to a desired page.If you have 10 pages and you want to go to page 9 you would just input 9 and hit enter.This feature is available in DataTables here is an exampleso how to do this with Tabulator? thank you
推荐答案
http://tabulator.info/docs/4.6/page#manage
您需要使用 table.setPage(x)
函数,其中 table 是您的 Tabulator 实例,x 是您想要转到的页码.
You would need to use the table.setPage(x)
function where table is your Tabulator instance and x is the page number you want to go to.
这里有一个示例,说明事件侦听器函数在您的元素之一上的样子.
So here is an example of what the event listener function would look like on one of your elements.
function pageListener(event){
if (isNaN(event.target.value)){
// We don't want anything that isn't a number.
return;
}
// Assuming that 'table' is a variable containing the
// Tabulator instance
table.setPage(Number(event.target.value));
}
这是一个工作示例.https://jsfiddle.net/nrayburn/fewqhuar/1/
这篇关于使用 Tabulator 分页所需的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!