Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Drools Fusion
- jquery
- SVN
- Spring
- CEP
- Hudson
- spring jpa
- querydsl
- gwt-ext
- zabbix
- drools
- JBoss Seam
- bootstrap jquery datepicker
- maven
- gwt
- jenkins
- MySQL
- rember me
- JPA
- jstl
- java tip
- GEventEvaluator
- jquery serialize
- ibatis
- custom filter
- spring transaction
- guvnor
- @SqlResultSetMapping
- COC
- spring security
Archives
- Today
- Total
봉 블로그
jquery table rowspan 처리하기. 본문
구글링을 해서 찾은 코드 중에 아래 코드가 제일 깔끔하더군요.
원문 : http://willifirulais.blogspot.com/2007/07/jquery-table-column-break.html
위 원문을 좀 수정했습니다. ^^
사용방법 :
$("#tableId").rowspan(0); //병합하고자 하는 column index를 인자로 넘겨준다.
rowspan 확장메소드 코드는 아래와 같습니다.
(function($){ $.fn.rowspan = function(colIdx) { return this.each(function(){ var that; $('tr', this).each(function(row) { $('td:eq('+colIdx+':visible)', this).each(function(col) { if ($(this).html() == $(that).html()) { rowspan = $(that).attr("rowSpan"); if (rowspan == undefined) { $(that).attr("rowSpan",1); rowspan = $(that).attr("rowSpan"); } rowspan = Number(rowspan)+1; $(that).attr("rowSpan",rowspan); // do your action for the colspan cell here $(this).hide(); // .remove(); // do your action for the old cell here } else { that = this; } that = (that == null) ? this : that; // set the that if not already set }); }); }); }; })(jQuery);
jquery 넘 조아~~ ^^.