getOrgFromIndex
getOrgFromIndex
Converts a display index — the position shown on screen after sorting or filtering — into the original, pre-sort index.
Parameters
path(String): The path of the list field in the DataSet (e.g."ds.list")idx(int): The display index to convert (as shown on screen after sorting or filtering)
Returns: number — the original index corresponding to that display index; returns idx unchanged if the list does not exist
Description
Use it when you need to know which row of the actual DataSet the Nth visible row of a sorted list maps to. This is the inverse of getIndexFromOrg.
:::warning Path separator
The path separator is ., not /. If you built a screen from a "stock/list"-style path, correct the path.
:::
Example
// 화면에서 4번째로 보이는 행(index 3)의 원본 인덱스 조회
var org = $vm.getOrgFromIndex("stock.list", 3);
$log.i("원본 인덱스:", org);
// 리스트 onSelected에서 원본 인덱스 기반으로 값 읽기
lsvList.onSelected = function(displayIndex) {
var orgIndex = $vm.getOrgFromIndex("ds.list", displayIndex);
var name = $vm.getDSValue("ds.list[" + orgIndex + "].name");
$log.i("선택 항목(원본):", name);
};
Related
$vm.getIndexFromOrg(path, org)— convert an original index to a display index (the inverse)$vm.getDSCurrent(path)— read the currently selected index (original order)