Skip to main content

getIndexFromOrg

getIndexFromOrg

Converts an original, pre-sort index into the display index — the position shown on screen after sorting or filtering.

Parameters

  • path (String): The path of the list field in the DataSet (e.g. "ds.list")
  • org (int): The original index to convert (based on the DataSet before sorting or filtering)

Returns: number — the display index corresponding to that original index; returns org unchanged if the list does not exist

Description

Use it when you need to know where the Nth row of the original DataSet appears on screen after sorting. This is the inverse of getOrgFromIndex.

Example

var blk = $vm.getIndexFromOrg("dummy-json_Resp.body.products", i);
// 원본 5번째 행이 정렬 후 화면에서 몇 번째인지 확인
var displayIdx = $vm.getIndexFromOrg("ds.list", 4);
$log.i("화면 표시 인덱스:", displayIdx);

// 원본 인덱스로 특정 행을 current로 선택하기
var displayIdx = $vm.getIndexFromOrg("ds.list", targetOrgIndex);
$vm.setDSCurrent("ds.list", targetOrgIndex);

Related

  • $vm.getOrgFromIndex(path, idx) — convert a display index to an original index (the inverse)
  • $vm.getDSCurrent(path) — read the currently selected index (original order)