具有实时点击事件功能的数据库 [英] Datatables with live click event function

查看:131
本文介绍了具有实时点击事件功能的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做的是当用户点击查看所有内容页面时,它将从分页视图中输出,因此我想要删除页面删除页面但不是第一个预览下一个最后链接的分页链接当用户点击查看分页记录时,它会添加第一预览下一个最后链接。



http://jsfiddle.net/xtremer360/hrfYA/7/

解决方案

p>如果你想根据你在做什么来显示/隐藏分页控件,你只需要显示/隐藏它们:

  $('。viewAll')。live('click',function(e){
e.preventDefault();
oTable.fnLengthChange(-1);
$(this) 。'''''''''''''''''''''''''''''''''''' ).hide();
});

$('。paginateRecords')。live('click',function(e){
e.preventDefault();
oTable.fnLengthChange(10);
$(this).removeClass('paginateRecords')。addClass('viewAll');
$(this).find('strong')。html('查看所有内容页');
$('。pagination')。show();
});

小提琴: http://jsfiddle.net/nicolapeluchetti/hrfYA/9/


What I am attempting to do is when the user clicks on the View All Content Pages it goes OUT of pagination view so I want it to remove the pagination links which it removes the pages but not the First Preview Next Last links, however when a user clicks on View Paginated Records then it adds the First Preview Next Last links.

http://jsfiddle.net/xtremer360/hrfYA/7/

解决方案

If you want to show/hide the pagination controls according to what you are doing you just need to show/hide them:

$('.viewAll').live('click', function(e) {
    e.preventDefault();
    oTable.fnLengthChange(-1);
    $(this).removeClass('viewAll').addClass('paginateRecords');
    $(this).find('strong').html('View Paginated Records');
    $('.pagination').hide();
});

$('.paginateRecords').live('click', function(e) {
    e.preventDefault();
    oTable.fnLengthChange(10);
    $(this).removeClass('paginateRecords').addClass('viewAll');
    $(this).find('strong').html('View All Content Pages');    
    $('.pagination').show();    
});

fiddle: http://jsfiddle.net/nicolapeluchetti/hrfYA/9/

这篇关于具有实时点击事件功能的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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