Nexacro

Dataset For문

Eva_0401 2020. 3. 16. 18:00

1. grid에서 조건에 만족하는 컬럼을 가져오기

 

for(var i = 0 ; i < this.ds_main.getRowCount() ; i++) {
    
    var a = String(this.ds_main.getColumn(i, "A컬럼명")); 		
    var b = String(this.ds_main.getColumn(i, "B컬럼명"));	
    
    var lastRow = this.ds_main.getRowCount;
    
    if(a=='1' && b=='1'){
    
    this.ds_main.setColumn(i,"A컬럼명",''); //A 컬럼안의 값을 공백으로 준다
    this.ds_main.setColumn(i,"B컬럼명",'hello'); //B 컬럼안의 값을 hello로 준다
    
	}else if(a=='0' && b=='1'){
    
    this.ds_main.setColumn(i,"A컬럼명",'hello'); //A 컬럼안의 값을 hello로 준다
    this.ds_main.setColumn(i,"B컬럼명",''); //B 컬럼안의 값을 공백으로 준다
    
    }else if(a=='0' && b==''){
    
     this.ds_main.filterRow(i,lastRow-1); //마지막 열을 숨기기(데이터자체에 총계가 있을 때 유용)

    }
}

 

  •  for문은  callback 안에서 실행 
  • 데이터 타입 확인을 잘 할 것