首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

关于jsp中table表格某一列,行去重的有关问题!

2013-09-06 
关于jsp中table表格某一列,行去重的问题!!!我点击一个按钮,就对页面中展现出来的table,进行行去重!------

关于jsp中table表格某一列,行去重的问题!!!
我点击一个按钮,就对页面中展现出来的table,进行行去重!


------解决方案--------------------


顶一楼! 用div控制table显隐
[解决办法]

var table_id="#showList";
    var colnum=3;
    var table_Obj = $(table_id + " tr td:nth-child(" +colnum + ")"); //nth-child  colnum=1  第一列
    table_Obj.each(function(i){  
         var rowSpan = $(this).attr("rowSpan");             
         if(rowSpan>1){        
             $(this).attr("rowSpan",1);
             var cloneTmp = $(this).clone()
             for(var i=1;i<rowSpan;i++){                    
             $(this).parent('tr').next('tr').append(cloneTmp);
             }
         }
     });

[解决办法]
function preTable(table_id,colnum){
//重新排序     #showList   1
var table_Obj = $(table_id + " tr td:nth-child(" +colnum + ")"); //nth-child  colnum=1  第一列
table_Obj.each(function(i){  
if($(this).hide()){
$(this).show();
}
if($(this).attr("rowspan")>1){
$(this).attr("rowspan","1");
}
 });
}

热点排行