row = event.source.parent.row
the event is the action performed, its source is the button, and the button's parent is NOT the table.
I'm not sure how you got that path... try row = event.source.parent.getComponent('Table').selectedRow
datasets manipulation functions return NEW datasets. So you're not really deleting a row from your dataset, only creating a new one with that row removed, and then doing nothing with it.
try event.source.parent.getComponent('Table').data = system.dataset.deleteRow(data, row)
What's that cellEdited event supposed to do ? You don't need that.
Along, with what @justinedwards.jle and @pascal.fragnoud have said, it should be noted that if the source of the data in your table is coming from a binding, then you need to also remove the row from source data, otherwise the binding will just overwrite any change that you have made.
In that instance I would say that you should actually remove the row from the source and then refresh the binding.
The selected row will be zero indexed just like the table. I don't normally see developers adding a 1 to it. For deleting rows, this step isn't needed, but I'm imagining that you are doing other things with this property.
For deleting selected rows from a button, the whole script should look like this:
# Get the table, its data property, and the selected row
table = event.source.parent.getComponent('Table')
tableData = table.data
row = table.selectedRow
# if a row is selected, create a dataset without the row
# ...and assign it back to the table's data property.
if row != -1:
table.data = system.dataset.deleteRow(tableData, row)
I've excluded the message box else clause from your original post. Personally, I don't like them because they are gui locking. I would go with a label or some other indicator for that purpose.