STAR TREK 2d20
  1. #1

    Simple question on db.addhandler

    Why does this work (onSourceUpdate is called):


    Code:
    					
    DB.addHandler(DB.getPath(node, "defenses.*"), "onChildUpdate", onSourceUpdate);
    But this doesn't (onSourceUpdate is NOT called)?

    Code:
    					
    DB.addHandler(DB.getPath(node, "defenses.ac.base"), "onChildUpdate", onSourceUpdate);
    DB.addHandler(DB.getPath(node, "defenses.ac.shield"), "onChildUpdate", onSourceUpdate);
    DB.addHandler(DB.getPath(node, "defenses.ac.misc"), "onChildUpdate", onSourceUpdate);
    I've a need to individually add a handler for defenses.ac.base, defenses.ac.shield, defenses.ac.misc and not include defenses.ac.total. When I list them individually it doesn't call onSourceUpdate when those items are updated.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    onChildUpdate will only trigger when child nodes of the one listed are updated. https://www.fantasygrounds.com/refdo...#onChildUpdate

    If you want to specify a specific node use onUpdate: https://www.fantasygrounds.com/refdo...e.xcp#onUpdate
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Quote Originally Posted by Trenloe View Post
    onChildUpdate will only trigger when child nodes of the one listed are updated. https://www.fantasygrounds.com/refdo...#onChildUpdate

    If you want to specify a specific node use onUpdate: https://www.fantasygrounds.com/refdo...e.xcp#onUpdate
    Oh gosh damn, I didn't even notice that slight difference!

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in