Deleting row/s from table

  • By default, the embedded view will receive a parameter rowData which contains all the data in the row. In your case you are only interested in the ÌD value.
  • On the embedded view you need to manually add params.custom.rowData.
  • Right-click on the delete button, select Configure Events, *onActionPerformed`, add a script and add the code below (indenting one tab).
def runAction(self, event):
    # Delete the record.
    system.db.runPrepUpdate('DELETE FROM config WHERE id = ?', [self.view.params.rowData['ID']])
    # Send a message to anything that's listening.
    system.perspective.sendMessage("dataTableChanged", payload = {}, scope = "session")
  • Right-click on the table to be updated, select Configure Scripts, add a message handler, call it `dataTableChanged" (exactly the same as in the sendMessage routine), set the listen scopes to "Session" and enter the following code.
def onMessageReceived(self, payload):
    self.refreshBinding("props.data")
4 Likes