-
December 17th, 2022, 15:36 #1
How to get change event in a different node on DB
This time I have a problem that I don't know if it's fixable.
I have a list of skills with the window that manages them, everything works fine. Then I have another window
where I manage skill groups. In this one I have a windowlist that allows me to add or remove skills from the
group. Here, too, everything works fine.
In the first window, those of the skills, I added a windowlist that allows me to see which groups the skill is in.
A function when loading (or when refreshing the window) scrolls the groups adding those in which the skill is
present. This works well too.
The problem I want to solve consists in real-time updating of the list in the skill window, i.e. I would like to see
the group list updated if I have the single skill window open and add this to one or more groups or remove it
from these.
Is there any way to do this? I should go and check if something has changed in a tag of the DB that is not
exactly that of the skill. Can I "register" to receive the change event of something within a different DB node?
-
December 17th, 2022, 19:30 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
You can register a change event.
DB.addHandler([node/path], "onUpdate", [callback_function]);
https://fantasygroundsunity.atlassia.../DB#addHandler
Regards,
JPG
-
December 17th, 2022, 20:31 #3
That's what I was needing! Ty.
Will onUpdate catch everything inside the node? Also additions and/or deletions? Even the children?
Or do I need to implement onAdd and onDelete as well, maybe even in the child version?
-
December 17th, 2022, 22:14 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
No, “onUpdate” is only to capture value changes on data nodes (string, number, etc).
The onChildAdded, onChildUpdate, and onChildDeleted events are for direct child change tracking.
JPG
-
December 17th, 2022, 22:49 #5
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks