Skip to main content

insertDSValue

insertDSValue

Inserts new row data at the front of a list field in the DataSet.

Parameters

  • recordPath (String): The path of the list field in the DataSet (e.g. "ds.list")
  • jsonData (any): The row data to insert — an object or an array of objects

Returns: booleantrue on success, false if the path is invalid

Description

Inserts a new row at the first position (index 0) of the DataSet's list field. Existing rows shift down by one index. Pass an array of objects to insert several rows at once. Inserted rows are applied to the DataSet immediately, so bound UI updates right away.

Example

// DataSet ds의 list 필드 맨 앞에 행 삽입
$vm.insertDSValue("ds.list", { name: "새 항목", price: 0 });

// 여러 행 한꺼번에 삽입
$vm.insertDSValue("ds.list", [
{ name: "항목A", price: 100 },
{ name: "항목B", price: 200 }
]);

Related

  • $vm.appendDSValue(recordPath, jsonData) — append a row to the end of the DataSet list
  • $vm.deleteDSValue(recordPath, count) — delete rows from the DataSet list
  • $vm.getDataCount(fieldPath) — read the DataSet list's row count