Query binding not refreshing with the refreshBinding command

I have text boxes that update based on a query. The user can add a comment in a text input box, which then gets put into a database and read back by a named query.

The problem is that the query binding doesn't update when it should. I have programmed a button to add the comment in the database and update the query to show the entered text on screen.

Right now, I send a message from the button after uploading to the DB, which should get read by a messageHandler on the comment table component. The message handler only contains self.refreshBinding("custom.downtimeCommentData"). custom.downtimeCommentData being the component bound by a query.

Message sent :

Message handler :

Polling the data at a set interval works to get the data, but I would prefer to have a more concrete solution (polling causes graphical glitches in the view)

If I understand correctly, you update a query record with a button which also triggers another query that reads the same record to verify the contents were modified? Maybe the read query is reading the record before the update is completed?

While I do believe this could be the case, there is some code that checks for a return value from the sending call to the DB before sending the message.

For more information, it seems the query does read after writing a comment and clicking the button, but it is always one query short (so if I write "1", nothing appears. Then, if I write "2", "1" appears, etc.)

I don't think a message handler is needed here. Try replacing the sendMessage lines with something like this, or whatever the component path is.


Just putting a delay (sleep()) before refreshing seems to do the trick.

	from time import sleep