자바/x-plaform

엑스플랫폼 그리드 공부

현규띠 2023. 12. 10. 03:54

초기 그리드의 상태


<Grid id="Grid00" taborder="4" useinputpanel="false" position2="absolute l:13 w:556 t:56 h:136" positiontype="position2">
  <Formats>
    <Format id="default"/>
  </Formats>
</Grid>

그리드 추가하는 로직


function Button03_onclick(obj:Button,  e:ClickEventInfo)
{
	 var v_ColId = "";
	 var v_Columns = "";
	 var v_BandHead = "";
	 var v_BandBody = "";
	 var v_Rows = "";
	 
	 trace(ds_Type_B.getColCount());
	 // Head 생성
	 //v_BandHead += '<Cell col="0' + '" text="' + v_ColId + '"/>\n';	 
	 // 263 291
	 for(var i=0; i<ds_Type_B.getColCount(); i++){
		 // Column ID 추출
		 v_ColId = ds_Type_B.getColID(i);
		  
		 // Column 생성
		 v_Columns += '<Column size="240" />\n';

		 // Head 생성
		 v_BandHead += '<Cell col="' + i.toString() + '" text="' + v_ColId + '"/>\n';
		  
		 // Body 생성
		 v_BandBody += '<Cell col="' + i.toString() + '" text="bind:' + v_ColId + '"/>\n';
	 
		// ds_Type_B 에서 Column ID 추출
		trace("ds_Type_B.getColID(i) : "+ds_Type_B.getColID(i));
		v_ColId = ds_Type_B.getColID(i);
		
		v_Rows += '<Row size="24" band="head" fix="fixed"/>\n';
		 v_Rows += '<Row size="20"/>\n';

		 v_Formats = '<Formats>\n';
		 v_Formats += '<Format id="default">\n';
		 v_Formats += '<Columns>\n';
		 v_Formats += v_Columns;
		 v_Formats += '</Columns>\n';
		 v_Formats += '<Rows>\n';
		 v_Formats += v_Rows;
		 v_Formats += '</Rows>\n';
		 v_Formats += '<Band id="head">\n';
		 v_Formats += v_BandHead;
		 v_Formats += '</Band>\n'; 
		 v_Formats += '<Band id="body">\n';
		 v_Formats += v_BandBody;
		 v_Formats += '</Band>\n';  
		 v_Formats += '</Format>\n'; 
		 v_Formats += '</Formats>\n';
		 
		 Grid00.enableredraw = false;
		 Grid00.binddataset = ds_Type_B;
		 Grid00.formats = v_Formats;
		 Grid00.enableredraw = true;
		 
		 //Grid00.autofittype = "col";​					
	}	
}

function Button04_onclick(obj:Button,  e:ClickEventInfo)
{

	 Grid00.fillareatype = "none";
	 var objDs = eval("ds_Type_B");
	 Grid00.binddataset = objDs;
	 //Grid00.binddataset = "ds_Type_B";
	 
	 //head/body/summ 영역구성
	 Grid00.appendContentsRow("head");
	 Grid00.appendContentsRow("body");
	 
	 //col생성 - appendContentsRow() 에서 컬럼이 기본으로 1개 생김
	 for(var r=1; r<objDs.getColCount(); r++)
	 {
	  Grid00.appendContentsCol();
	 }
	 
	 //col size 설정
	 for(var r=0; r<objDs.getColCount(); r++)
	 {
	  Grid00.setFormatColProperty(r,"size",100);
	 }
	 
	 //band별 셀속성 설정
	 for(var r=0; r<objDs.getColCount(); r++)
	 {
	  var colinfo = objDs.getColumnInfo(r);
	  trace("r : "+r);
	  trace("colinfo : "+colinfo);
	  trace("colinfo : "+colinfo.name);
	  Grid00.setCellProperty("head",r,"text",colinfo.name);
	  Grid00.setCellProperty("body",r,"text","bind:"+ colinfo.name);
	 }

	 //body 행 세로 크기 설정
	 trace("objDs.rowcount : "+objDs.rowcount);
	 Grid00.setFormatRowProperty(1,"size",30);

	 
	 Grid00.autofittype = "col";	
}

function Button04_onclick(obj:Button,  e:ClickEventInfo)
{

	 Grid00.fillareatype = "none";
	 var objDs = eval("ds_Type_B");
	 Grid00.binddataset = objDs;
	 //Grid00.binddataset = "ds_Type_B";
	 
	 //head/body/summ 영역구성
	 Grid00.appendContentsRow("head");
	 Grid00.appendContentsRow("body");
	 
	 //col생성 - appendContentsRow() 에서 컬럼이 기본으로 1개 생김
	 for(var r=1; r<objDs.getColCount(); r++)
	 {
	  Grid00.appendContentsCol();
	 }
	 
	 //col size 설정
	 for(var r=0; r<objDs.getColCount(); r++)
	 {
	  Grid00.setFormatColProperty(r,"size",100);
	 }
	 
	 //band별 셀속성 설정
	 for(var r=0; r<objDs.getColCount(); r++)
	 {
	  var colinfo = objDs.getColumnInfo(r);
	  trace("r : "+r);
	  trace("colinfo : "+colinfo);
	  trace("colinfo : "+colinfo.name);
	  Grid00.setCellProperty("head",r,"text",colinfo.name);
	  Grid00.setCellProperty("body",r,"text","bind:"+ colinfo.name);
	 }

	 //body 행 세로 크기 설정
	 trace("objDs.rowcount : "+objDs.rowcount);
	 Grid00.setFormatRowProperty(1,"size",30);

	 
	 //Grid00.autofittype = "col";	
}