jQuery를 이용한 테이블 셀병합

자바스크립트/jQuery 2013. 9. 7. 00:09

통계 화면을 구성하던 중 같은 값에 대해서 셀을 병합해야 했는데 서버 스크립트에서 복잡하게 하지 말고

jQuery를 이용해 클라이언트단에서 구현하는 방법을 찾아봤습니다.

이미 같은 문제로 고민해서 구현해 놓은 것 중에 어떤 분 말씀대로 가장 깔끔한 코드를 첨부합니다 ^^

셀이 병합되는 모습을 보기 싫다면 테이블을 감추고 병합 후에 보여주면 될 것 같습니다.

 

문제 화면

유효성 검사버전1.1
데이터 검사버전1.1
데이터 검사버전1.3

 

요구하는 화면

유효성 검사버전1.1
데이터 검사버전1.1
1.3


/*
 *
 * 같은 값이 있는 열을 병합함
 *
 * 사용법 : $('#테이블 ID').rowspan(0);
 *
 */    
$.fn.rowspan = function(colIdx, isStats) {      
    return this.each(function(){     
        var that;    
        $('tr', this).each(function(row) {     
            $('td:eq('+colIdx+')', this).filter(':visible').each(function(col) {
                 
                if ($(this).html() == $(that).html()
                    && (!isStats
                            || isStats && $(this).prev().html() == $(that).prev().html()
                            )
                    ) {           
                    rowspan = $(that).attr("rowspan") || 1;
                    rowspan = Number(rowspan)+1;
 
                    $(that).attr("rowspan",rowspan);
                     
                    // do your action for the colspan cell here           
                    $(this).hide();
                     
                    //$(this).remove();
                    // do your action for the old cell here
                     
                } else {           
                    that = this;        
                }         
                 
                // set the that if not already set
                that = (that == null) ? this : that;     
            });    
        });   
    }); 
};
 
 
/*
 *
 * 같은 값이 있는 행을 병합함
 *
 * 사용법 : $('#테이블 ID').colspan (0);
 *
 */  
$.fn.colspan = function(rowIdx) {
    return this.each(function(){
         
        var that;
        $('tr', this).filter(":eq("+rowIdx+")").each(function(row) {
            $(this).find('th').filter(':visible').each(function(col) {
                if ($(this).html() == $(that).html()) {
                    colspan = $(that).attr("colSpan") || 1;
                    colspan = Number(colspan)+1;
                     
                    $(that).attr("colSpan",colspan);
                    $(this).hide(); // .remove();
                } else {
                    that = this;
                }
                 
                // set the that if not already set
                that = (that == null) ? this : that;
                 
            });
        });
    });
}

셀병합 호출
//첫번째 열을 병합한다.
$('#테이블 ID').rowspan(0);


출처 : http://shuiky.tistory.com/entry/jQuery%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%9C-%ED%85%8C%EC%9D%B4%EB%B8%94-%EC%85%80%EB%B3%91%ED%95%A9


:

WAS 별 default servlet name

서버/기타 2013. 9. 4. 20:16

※ 
Tomcat : default
Resin : resin-file
Weblogic :  FileServlet
WebSphere : SimpleFileServlet
jetty : default
jboss : default
jeus : WorkerServlet

:

Windows 평가판 유예기간 연장 (초기화)

서버/Windows 2013. 8. 19. 16:25

평가판 유예기간 연장(초기화)

 

마이크로소프트 소프트웨어 라이선스 매니저를 이용하여 유예기간을 연장한다.

실제로는 남은 일 수를 초기화 시키는 방식으로 연장이 이루어진다.


 

프로그램 위치 : C:\Windows\system32\slmgr.vbs

 

사용법 : slmgr  -rearm ↙

(재부팅해 주어야 최종 적용됨)

 


※ slmgr 옵션

-dli : 라이선스 정보 확인.

-dlv : 상세 라이선스 정보 확인. 유예기간(Grace period)과 유예기간 연장횟수(rearm counts) 확인 가능.

-xpr : 라이선스 만료일자 확인.

-rearm : 평가판 유예기간 초기화


: