数据表中的页面事件示例? [英] Example of Page Event in Datatables?

查看:177
本文介绍了数据表中的页面事件示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪的问题 - 我正在寻找一个例子,说明如何在我正在处理的DataTables项目中将页面事件置于行动状态。

Strange question -- I'm looking for an example of how to put a 'page' event into action in a DataTables project I'm working on.

文档在这里 - http://datatables.net/docs/DataTables/1.9。 4 /#page 。我只是无法将其转化为一个可以使用的工作示例。

The documenation is here -- http://datatables.net/docs/DataTables/1.9.4/#page. I'm just unable to translate that into a working example to use.

更具体地说,我试图运行一个读取每一行的函数,如果他们中的任何一个都有一个特定的类(由用户交互创建),然后将其删除,并在每个页面更改事件上发生这种情况。我已经写了这个函数,如果我修改了API,它可以工作,但是如果我能以某种方式描述上述的页面事件,那将是理想的。

To be more specific, I'm trying to run a function that reads every row, and if any of them have a specific class (created by user interaction), then remove it -- and have this happen on every page change event. I have this function written, and it works if I modify the API, but if I can somehow this to the page event described above, that would be ideal.

谢谢提前为您的帮助,任何信息的真实感谢!

Thank you in advance for your help, and any tidbits of information are truly appreciated!

此外,我在Datatables 1.7.6,如果这有帮助!

In addition, I'm on Datatables 1.7.6, if that helps!

推荐答案

我发现(从他们的论坛上的Datatables的创建者),这段代码如下:

I found out (from the creator of Datatables on their forums), that this code below works:

$('#myTable').on('page', function () {...} );

只有在1.8或更高版本上才有效,为了我的目的,它工作得很好。

It only works if you are on version 1.8 or greater, and for my purposes, it worked perfectly.

另外,如果您需要在每个表加载上运行一个函数,而不是页面事件,可以使用fnDrawCallback。我正在分享这个,因为我希望几天前我已经澄清了,因为这会节省我几个小时!

Also, if you need to run a function on each table load, instead of of the page event, you can use fnDrawCallback. I'm sharing this because I wish that I had this clarified a few days ago because it would have saved me hours!

这篇关于数据表中的页面事件示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆