动态显示列/隐藏列实现
动态显示列/隐藏列实现
lgscofield 发表于2年前
动态显示列/隐藏列实现
  • 发表于 2年前
  • 阅读 2
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 新注册用户 域名抢购1元起>>>   

动态显示列/隐藏列实现
Requied
[color=cyan][/color]
jquery.clickmenu.js (15kb)
jquery.clickmenu.pack.js (4kb)
clickmenu.css (2kb - it won’t work without this)

Example zero (all-in-one):

create the column header list inside the element with the ID "targetone"
define on and off classes for the column header list
don't include the last two columns in the list
save the visibility state informations for the next visit
hide the columns one and three by default
toggle the columns through the three buttons
use custom show/hide functions when using the buttons
 
    $('#tableall').columnManager({listTargetID:'targetall', onClass: 'advon', offClass: 'advoff', hideInList: [4,5],  
                    saveState: true, colsHidden: [1,3]}); 
     
    var opt = {listTargetID: 'targetall', onClass: 'advon', offClass: 'advoff',  
            hide: function(c){ 
                $(c).fadeOut(); 
            },  
            show: function(c){ 
                $(c).fadeIn(); 
            }}; 
    $('#buttonone').click(function(){ $('#tableall').toggleColumns(1, opt); }); 
    $('#buttontwo').click(function(){ $('#tableall').toggleColumns(2, opt); }); 
    $('#buttonthree').click(function(){ $('#tableall').toggleColumns(3, opt); }); 
    $('#buttonshowall').click(function(){ $('#tableall').showColumns(null, opt); }); 
    $('#buttonshow').click(function(){ $('#tableall').showColumns([1], opt); }); 
    $('#buttonhide').click(function(){ $('#tableall').hideColumns([2, 3], opt); });


<script type="text/javascript">  
$(document).ready(function()  
{  
    $.fn.clickMenu.setDefaults({arrowSrc:'arrow_right.gif', onClick: function(){/*do something*/}});  
    $('selector1').clickMenu(); /* use default values */  
    $('selector2').clickMenu({arrowSrc:''}); /* dont use an arrow for submenus */  
    $('selector3').clickMenu({subDelay: 1000, mainDelay: 500}); /* slow menu */  
});  
</script>
标签: jQuery
共有 人打赏支持
lgscofield
粉丝 20
博文 105
码字总数 62676
×
lgscofield
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: