sap bps web interface中的layout控件,不知道如何去改变同列值相同合并的功能,因为要用以前使用的js来做save to excel功能,而我又恰恰不需要开始的两列,所以特定写了一段代码进行列删除。 列删除唯一要考虑的是对应存在行合并的列,需要跳过一些行。
&(\”#layout_download-table\”).find(\”tr\”).each(function(i){
if(i == 0){ // 第一行是标题,直接删除就好了
&(this).find(\”td\”).eq(0).remove();
&(this).find(\”td\”).eq(0).remove();
}else if(i == 1 ){ //从第二行开始可能存在行合并的情况
c1_rows= &(this).find(\”td\”).eq(0).attr(\”rowspan\”);
c2_rows= &(this).find(\”td\”).eq(1).attr(\”rowspan\”);
&(this).find(\”td\”).eq(0).remove();
&(this).find(\”td\”).eq(0).remove();
c1_rows = c1_rows – 1;
c2_rows = c2_rows – 1;
}else if( i > 1){
if( c1_rows > 0){ //还有合并行,所以要在考虑
c1_rows = c1_rows – 1;
if(c2_rows > 0){
//什么也不用做
c2_rows = c2_rows – 1;
}else{
c2_rows= &(this).find(\”td\”).eq(0).attr(\”rowspan\”);
&(this).find(\”td\”).eq(0).remove();
c2_rows = c2_rows – 1;
}
}else{ //重新开始获取合并行数
c1_rows= &(this).find(\”td\”).eq(0).attr(\”rowspan\”);
c2_rows= &(this).find(\”td\”).eq(1).attr(\”rowspan\”);
&(this).find(\”td\”).eq(1).remove();
&(this).find(\”td\”).eq(1).remove();
c1_rows = c1_rows – 1;
c2_rows = c2_rows – 1;
}
}
});
又老了半岁,不过还好,理清楚了。