# GridRowRef

GridRowRef의 필드와 허용 값, 이 타입을 사용하는 API입니다.

Canonical: https://grid.syidax.com/ko/docs/types/GridRowRef/

<a id="definition"></a>

## 타입 정의

물음표(?)는 선택 항목이고 readonly는 직접 변경하지 않는 값입니다. 유니온(|)은 허용된 형태 중 하나를 뜻합니다. 함수는 해당 시점에 Grid가 호출할 콜백입니다.

```typescript
export interface GridRowRef<
  TData = GridData,
  TContext = unknown,
> extends GridLiveRef<TData> {
  readonly id: GridRowId;
  getSourceIndex(): number | null;
  getDisplayIndex(): number | null;
  getData(): Readonly<TData> | null;
  getParent(): GridRowRef<TData, TContext> | null;
  getChildren(): ReadonlyArray<GridRowRef<TData, TContext>>;
  isGroup(): boolean;
  isLeaf(): boolean;
  isMaster(): boolean;
  isDetail(): boolean;
  getLevel(): number;
  getRoute(): readonly string[];
  isSelected(): boolean;
  isExpanded(): boolean;
  setSelected(selected: boolean): Promise<boolean>;
  setExpanded(expanded: boolean): Promise<boolean>;
  setData(data: TData): Promise<boolean>;
  updateData(patch: Partial<TData>): Promise<boolean>;
  setValue<TField extends GridFieldPath<TData>>(
    field: TField,
    value: GridPathValue<TData, TField>,
  ): Promise<boolean>;
  setHeight(height: number | null): Promise<boolean>;
  focus(field?: GridFieldPath<TData>): Promise<boolean>;
  startEditing(field: GridFieldPath<TData>): Promise<boolean>;
}
```

<a id="used-by"></a>

## 이 타입을 사용하는 API

- [getRow](https://grid.syidax.com/ko/docs/methods/getRow.md) — 안정적인 행 ID로 행 객체를 찾습니다. 화면 인덱스로 찾는 API와 구분합니다.
- [getDisplayedRowAtIndex](https://grid.syidax.com/ko/docs/methods/getDisplayedRowAtIndex.md) — 현재 표시 순서의 인덱스로 행 객체를 찾습니다. 정렬·필터·그룹에 따라 같은 인덱스의 행은 달라질 수 있습니다.
- [forEachRow](https://grid.syidax.com/ko/docs/methods/forEachRow.md) — 행 객체를 순회하며 콜백을 실행합니다. 현재 화면의 표시 순서가 필요하면 forEachDisplayedRow를 사용합니다.
- [forEachDisplayedRow](https://grid.syidax.com/ko/docs/methods/forEachDisplayedRow.md) — 현재 표시 행을 순회합니다. 원본 데이터 순서와 표시 순서를 구분해야 하는 앱 기능에 사용합니다.

<a id="parents"></a>

## 이 타입을 포함하는 계약

- [SyGridImperativeMethods](https://grid.syidax.com/ko/docs/types/SyGridImperativeMethods.md)

<a id="related"></a>

## 연결된 타입

- [GridData](https://grid.syidax.com/ko/docs/types/GridData.md)
- [GridLiveRef](https://grid.syidax.com/ko/docs/types/GridLiveRef.md)
- [GridRowId](https://grid.syidax.com/ko/docs/types/GridRowId.md)
- [GridFieldPath](https://grid.syidax.com/ko/docs/types/GridFieldPath.md)
- [GridPathValue](https://grid.syidax.com/ko/docs/types/GridPathValue.md)
