I render a column to a view.
In the view , I add a button.
In the button , I want to click to sendmessage to do sth.
But I find when I click it ,send all rows message?
def messageBox(title,message):
system.perspective.openPopup("messageBox",'Poup/messageBox', title=title,params = {'message':message}, showCloseIcon = True, resizable = True,modal=True)
You're not actually using your id
that you are retrieving from rowData
. So you send one message, but on the receiving end, every button receives it and that's why you get 4 confirm messages. You need to filter on the id
somehow
Inside of the infoConfirm
message handler, add a check to make sure that the id
you pass in from your button click matches the row's ID and only then print. I'm assuming your script is going to do something more than just print a statement.
Something like
id = payload["id"] # of course, first pass the id in the payload to receive it
if id == self.view.params.rowData["id"]:
system.perspective.print("received message for id: {}".format(id))
should help you filter out to only receive one message.