foreach循环遍历 行合并
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<style type="text/css"> table{
border: 1px solid black;
border-collapse: collapse;
}
td{
border: 1px solid black;
text-align: center;
}
</style>
</head>
<body>
<table align="center" width="650px">
<tr bgcolor="#CCFFFF">
<td>序号</td>
<td colspan="2">项目</td>
<td>1月</td>
<td>2月</td>
<td>3月</td>
<td>x年合计</td>
</tr>
<c:forEach items="${configApp}" var="configAppname" varStatus="index">
<c:set var="ca" value="${configAppname.configProjectType.projectName}"/>
<c:set var="count" value="0"/>
<c:forEach items="${configApp}" var="configApps">
<c:if test="${configApps.configProjectType.projectName==ca}">
<c:set var="count" value="${count+1}"/>
</c:if>
</c:forEach>
<tr>
<td>${index.count}</td>
<td class="hebing">${configAppname.configProjectType.projectName}</td>
<td>${configAppname.appName}</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</c:forEach> <tr>
<td></td>
<td colspan="2">项目收入合计</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</body>
</html>
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script>
$(function(){
$('.hebing').each(function(index, element) {
if(!$(this).hasClass('hide'))
{ var next=$(this).parent('tr').next('tr').children('.hebing');//下一个合并的对象
$(this).attr('rowspan',1);
while($(this).text()==next.text())
{
$(this).attr('rowspan',parseInt($(this).attr('rowspan'))+1);
next.hide();
next.addClass('hide');
next=next.parent('tr').next('tr').children('.hebing');//下一个合并的对象
}
}
});
});
</script>
foreach循环遍历 行合并的更多相关文章
- yii2通过foreach循环遍历在一个用户组中取出id去另一表里查寻信息并且带着信息合并原数组信息---案例
yii2通过foreach循环遍历在一个用户组中取出id去另一表里查寻信息并且带着信息合并元数组信息---案例 public function actionRandomLists(){ //查询到了所 ...
- for循环和foreach循环遍历集合的效率比较
先上代码 package com.test; import java.util.ArrayList; import java.util.LinkedList; import java.util.Lis ...
- C# foreach 循环遍历数组
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...
- IT兄弟连 Java语法教程 数组 使用foreach循环遍历数组元素
从JDK5之后,Java提供了一种更简单的循环:foreach循环,也叫作增强for循环,这种循环遍历数组和集合更加简洁.使用foreach循环遍历数组和集合元素时,无需获得数组或集合的长度,无需根据 ...
- 二维数组遍历的方式(for普通循环遍历、foreach循环遍历、toString方式遍历)
package com.Summer_0421.cn; import java.lang.reflect.Array; import java.util.Arrays; /** * @author S ...
- es6的foreach循环遍历
forEach forEach是Array新方法中最基本的一个,就是遍历,循环.例如下面这个例子: 结果: 这段代码相当于: for (var k = 0, length = array.length ...
- php中foreach循环遍历二维数组
最近在用tp3.2框架,在查询的时候用到了select(),这条语句返回的是二维数组,所以在对返回的数据做处理时,遇到了些麻烦,百度了下foreach,终于用foreach解决了数据的筛选问题 (因为 ...
- foreach 循环遍历 以及函数的应用
foreach( 对集合每个元素的引用 in 集合 ){ } 举例: int[] a = new int[5]{1,2,3,4,5};foreach( int b in a ){ //b就是a中的每个 ...
- mybatis问题。foreach循环遍历数组报错情况,及其解决方法
根据条件查询数据列表,mybatis查询代码如下 如果只查询属于特定部门拥有的数据权限.这需要用 String[ ] codes保存当前部门及其子部门的部门编码. 所以需要在mybatis中遍历编码数 ...
随机推荐
- AngularJS:Bootstrap
ylbtech-AngularJS:Bootstrap 1.返回顶部 1. AngularJS Bootstrap AngularJS 的首选样式表是 Twitter Bootstrap, Twitt ...
- C字符串翻转
实现字符串翻转,思路很简单,就是首尾字符对调. void reverse(char* str){ char* p = str + strlen(str) - 1;//最后一个字符地址 char tem ...
- windows黑科技-记录dns log
昨天看到袁哥微博,看到了这篇,今天测试了一下,记录下来: The DNS Client service does not log by default. However, if a file name ...
- Java 的标识符
标识符: 在写代码的时候为了增强代码的阅读性会自定义很多名字,如:类名.方法名.变量名等 这种名称成为标识符 标识符命名规则: 由字母(可以是中文).数字.下划线.$ 组成,但不能以数字开头 大小写敏 ...
- Python打造一个目录扫描工具
目标:用Python3写一款小型的web目录扫描工具 功能:1.扫描指定站点 2.指定网站脚本类型来扫描 3.可控线程 4.可保存扫描结果 首先定义一个命令参数的函数 def parse_option ...
- java 多线程系列基础篇(八)之join()、start()、run()方法
1. join()介绍 join() 定义在Thread.java中.join() 的作用:让“主线程”等待“子线程”结束之后才能继续运行.这句话可能有点晦涩,我们还是通过例子去理解: // 主线程 ...
- 问题:C#后台获取tr;结果:C# <tr id="a" runat="server"> 怎么在后台用FindControl找到这个tr的id?
C# <tr id="a" runat="server"> 怎么在后台用FindControl找到这个tr的id? 2013-05-30 10:52 ...
- Linux 查看一个端口的连接数
netstat -antp|grep -i "80" |wc -l 譬如查看80端口的连接数
- 地图投影的N种姿势(转载)
转载地址:http://blog.sina.com.cn/s/blog_517eed9f0102w4rm.html 一篇题为<我们看到的地图一直都错得离谱……>的文章在朋友圈里莫名流行起来 ...
- (内存地址hashcode与对象内容hashcode)分析== 和 equal()方法
==.equals()和hashCode()字符串测试 1.hashCode() 是根据 内容 来产生hash值的 2.System.identityHashCode() 是根据 内存地址 来产生ha ...