system.dataset.deleteRow
Takes a dataset and returns a new dataset with a row removed. Datasets are immutable, so it is important to realize that this function does not actually remove the row from the argument dataset. You'll need to do something with the new dataset that this function creates to achieve something useful.
system.dataset.deleteRow(dataset, rowIndex)
-
Parameters
Dataset dataset - The starting dataset. Please be aware that this dataset will not actually be modified (datasets are immutable), but rather will be the starting point for creating a new dataset.
int rowIndex - The index (starting at 0) of the row to delete. Will throw an IndexError if less than zero or greater than len(dataset)-1.
-
Returns
Dataset - A new dataset with the specified row removed.
-
Scope
All
#This example would remove the selected row from a List component, by re-assigning the List's data property to the new dataset returned by thedeleteRow function.
myList
=
event.source.parent.getComponent(
"List"
)
row
=
myList.selectedIndex
if
row !
=
-
1
:
# make sure there is something selected
myList.data
=
system.dataset.deleteRow(myList.data, row)