Power Table drag and drop

This allows a single row or multiple rows to be moved between the same table. Seems to work with multiple and single interval selection mode. Sorry for the list comprehensions. The try and except block are needed because of indexing issues when moving rows to the bottom of a dataset.

data = self.data

allRows = [[rowData.getValueAt(rowNdx, colNdx) for colNdx in range(rowData.columnCount)] for rowNdx in range(rowData.rowCount)]

try:
	self.data = system.dataset.deleteRows(self.data,rows)
	self.data = system.dataset.addRows(self.data, dropIndexLocation, allRows)
except:
	data = system.dataset.addRows(data, dropIndexLocation, allRows)
	data = system.dataset.deleteRows(data,rows)
	self.data = data

self.selectedRow = -1
3 Likes