트리그리드 » Api
getitemdepth
Description
트리그리드의 특정 Row의 트리 Depth를 읽어 들이는 API이다.
최상위 아이템의 트리 Depth는 0이고 자식아이템의 Depth는 0부터 하위 레벨로 갈수록 1씩 증가된다. 따라서 특정 아이템의 Deph를 읽어 들이면 최상위아이템으로 부터 몇레벨 아래 자식 아이템인지 알수 있다.
Parameters
Parameters |
Type |
Description |
nRow |
long |
행 인덱스 |
Return Value
Type |
Description |
short |
아이템의 트리 Depth |
Remark
* Depth 예제
최상위아이템1 - Depth(0)
- 자식 아이템 - Depth(1)
- 자식 아이템 - Depth(2)
- 자식 아이템 - Depth(1)
최상위아이템2 - Depth(0)
- 자식 아이템 - Depth(1)
Example
function btnInsert_on_mouseup(objInst)
{
var nSelectRow = gg.getselectrow();
if(nSelectRow < 0) {
return;
}
if(gg.ishaschildren(nSelectRow) == true) {
var nSelectRowDepth = gg.getitemdepth(nSelectRow);
factory.consoleprint(gg.getitemtext(nSelectRow, 0) + " - Depth(" + String(nSelectRowDepth) + ")");
var nPrevDepth = nSelectRowDepth;
for(var nRow = nSelectRow + 1;nRow < gg.getrowcount();nRow++) {
var nTreeDepth = gg.getitemdepth(nRow);
if(nTreeDepth <= nSelectRowDepth) {
break;
}
var strSpace = "";
for(var nCount = nSelectRowDepth;nCount <= nTreeDepth;nCount++) {
strSpace += " ";
}
factory.consoleprint(strSpace + "- " + gg.getitemtext(nRow, 0) + " - Depth(" + String(nTreeDepth) + ")");
nPrevDepth = nTreeDepth;
}
}
}
----------------------------------------------------------------------------
// 결과
그룹1 - Depth(0)
- 아이템1 - Depth(1)
- 아이템2 - Depth(1)
- 서브그룹1 - Depth(1)
- 서브그룹아이템1 - Depth(2)
- 서브그룹아이템2 - Depth(2)
See Also
getitemkey
Viewer Ver.
9.1.1.1
Update Date
20061108