Open semireg opened 1 year ago
@semireg did you ever work out how to solve this?
On another note... is there any way to push data from server to client when onSelectionChange is called?
Hi @enuchi - can you make any suggestions about how to cause updates to a sidebar UI when the user changes selection and an onSelectionChange()
server side SimpleTrigger is called?
Not sure. You'll have to get creative because I doubt there's an official way to do this.
You could try writing to the properties service from the trigger and polling changes from the UI?
Thanks @enuchi - how would you suggest implementing the polling on the client side?
Something like setInterval(() => {serverFunctions.checkIfUpdated.then(...)}, 3000)
https://developer.mozilla.org/en-US/docs/Web/API/setInterval
I've got polling working fine, and it calls back a serverFunction to get the active sheet & row, but I can't see how to use the PropertiesService from the client code?
Or would that just be to hold the "updated state" in the server code and then on interval the client would call that back & grab any updated state (if it was updated) - calling via a server function?
Correct
thanks FWIW this node package worked a treat for the polling/interval https://www.npmjs.com/package/@use-it/interval
If I add a property to a template in ui.js such as:
How do I access "uuid" in React via Scriptlets?
I've tried modifying sidebar/index.html
But I'm not seeing anything. It's probably obvious... 😄
On another note... is there any way to push data from server to client when onSelectionChange is called?