Skip to main content

setDSCurrent

setDSCurrent

Sets the currently selected index of a DataSet list field.

Parameters

  • path (String): The path of the list field in the DataSet (e.g. "ds.list")
  • current (int): The row index to select. -1 clears the selection

Returns: None (void)

Description

Marks a specific row in the list as currently selected. Even when sorting or filtering is applied, the value is converted to and handled as an original index. Passing -1 clears the selection.

:::warning Path separator

The path separator is ., not /. If you built a screen from a "stock/list"-style path, correct the path.

:::

Example

// 3번째 행 선택 (0-based index)
$vm.setDSCurrent("stock.list", 2);

// 선택 해제
$vm.setDSCurrent("stock.list", -1);

// 리스트 클릭 이벤트에서 current 설정
lsvList.onSelected = function(index) {
$vm.setDSCurrent("ds.list", index);
};

Related

  • $vm.getDSCurrent(path) — read the currently selected index
  • $vm.getDSValue(path) — read a DataSet value