Selected rows rowindexes

I have a huge json dataset.
I can select more rows in the perspective table.

In the propertie I find my rows.
In the props.selection.selectedRow I find my first selected rowindex.

I want to delete all selected rows in a script.
the system.dataset.deleteRows() removes only the rows specified by index.
I dont want to loop through my full dataset because of performance issues occuring then.
How do I remove the selected jsonrows from from the or how do I know all the rowindexes and not only the first one without the need to loop through the whole table?

1 Like

Also ran into this issue when on mobile, trying to select multiple rows. I can add the event.value object to but can’t figure out how to make the table visually reflect multiple selected rows without a keyboard to hold the ‘ctrl’ button.

@joostjojo, I’m having the exact same problem now. Did you ever solve your issue?

I have populated a Perspective Table with data, then will send that data in a query to a database.

My issue is I need some way of deleting multiple rows of the table before I initiate the query.

I would’ve expected the props.selection.selectedRow to either change into a list [3,8,11] or something that would indicate when more than one row is selected.

To have to loop through all the to find the indices of those rows seems painful.

@cmallonee, do you or anyone else have a workaround? Maybe this should be a feature request?

Apparently, it already is.

As a workaround, I’ve tested this and it works (for anyone that’s still interested):

# Get the table data
ds = self.parent.parent.getChild("Table")

# Convert dataset to PyDataset for easier iteration
pyData = system.dataset.toPyDataSet(ds)

# Get the selectedData
selectedData = self.parent.parent.getChild("Table")
selRows = []

# Loop through and to find indices of selectedRows
# selRows is the resultant list of rows (indexes) that have been selected
for i in selectedData:
	pos = 0
	for row in pyData:
		if row['ColumnName'] == i['ColumnName']:
		pos += 1

# Delete rows based on selRows
ds = system.dataset.deleteRows(ds, selRows)

# Write the dataset back to the table
self.parent.parent.getChild("Table") = ds

# De-select all rows in the table
self.parent.parent.getChild("Table").props.selection.selectedRow = None

I still hope they make props.selection.selectedRow return a list of rows actually selected, not just the last one.