论坛首页 Web前端技术论坛

JS合并表格

浏览 2331 次
锁定老帖子 主题:JS合并表格
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-09-18   最后修改:2010-12-17
 /**
  js 合并行的函数
  */
  function compRows(tabId)
  {
   var tab=document.getElementById(tabId);
   var rowspna = 1;
   if(tab.rows != null){
   for(var j = 0; j < tab.rows[0].cells.length; j ++){
   for(var i=1;i    {
   if (tab.rows[i].cells[j].innerHTML == tab.rows[i - 1].cells[j].innerHTML) 
   {
   rowspna += 1;
   tab.rows[i].cells[j].style.display = "none";
   tab.rows[i - rowspna + 1].cells[j].rowSpan = rowspna;
   } 
   else 
   {
   rowspna = 1;
   }
   }
   }
   }
  }




JAVA 方式:

int changeSize = 0;
if(sExchange != null)
changeSize = sExchange.size();
ArrayList tempList = new ArrayList(changeSize);
ArrayList resultList = new ArrayList(changeSize);
long firstOwnerId = 0;
String objCode = "";

if(sExchange != null && sExchange.size() != 1){
for(int iOffSet=0;iOffSet< sExchange.size();iOffSet++)
{

SFundamentInfo sTemp = (SFundamentInfo)sExchange.get(iOffSet);
SCheckObjectInfo checkObjectInfo=(SCheckObjectInfo)listCheckObjectInfo.get(iOffSet);
//综合指标

if(firstOwnerId == sTemp.get_ownerId()){
int iTemp = 0;
if(tempList.get(iOffSet - 1) != null)
iTemp = Common.getIntValue(tempList.get(iOffSet - 1));
if(iOffSet - 1 >= 0)
tempList.set(iOffSet - 1, "0");
tempList.add(String.valueOf(iTemp + 1));


}else{

tempList.add("0");
}

firstOwnerId = sTemp.get_ownerId();


//计算
String[] tempStr = new String[2];
if(objCode.equals(checkObjectInfo.get_objectCode())){
int iTmp = 0;
double iTemp = 0.0;
tempStr[0] = "0";
tempStr[1] = "" + iTemp;
if(resultList.get(iOffSet - 1) != null){
String[] tempStr2 = (String[])resultList.get(iOffSet - 1);
iTmp = Common.getIntValue(tempStr2[0]);
iTemp = Common.getStrToDouble(tempStr2[1]);
}
if(iOffSet - 1 >= 0)
resultList.set(iOffSet - 1, new String[]{"0","0"});

String[] tempStr2 = {String.valueOf(iTmp + 1), String.valueOf(iTemp + sTemp.get_lastValue())};
resultList.add(tempStr2);


}else{
//String[] tempStr = new String[2];
tempStr[0] = "0";
tempStr[1] = String.valueOf(sTemp.get_lastValue());
resultList.add(tempStr);
}

objCode = checkObjectInfo.get_objectCode();
}



}else{
tempList.add("1");
SFundamentInfo sTemp = (SFundamentInfo)sExchange.get(0);
resultList.add(new String[]{"1",String.valueOf(sTemp.get_lastValue())});
}
//重排 
for(int i = 1; resultList != null && i < resultList.size(); i ++){

String[] tempStr = (String[])resultList.get(i);
if(tempStr != null){
int iTmp = Common.getIntValue(tempStr[0]);
double iTempD = Common.getStrToDouble(tempStr[1]);
if(iTmp > 0) {

resultList.set((i - iTmp), tempStr); 
resultList.set(i, new String[]{"0","0"});
}
}

} 




   发表时间:2010-03-29  
错误的JS代码~
0 请登录后投票
   发表时间:2010-03-29  
suiye007 写道
错误的JS代码~



兄弟那里错误了?
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics