Understanding DB.handler and onChildDeleted
Hi,
I think I have to ask in a new thread, instead in my ruleset thread. Makes more sense.
I have a windowlist (name: armorlist, data source: .inventorylist), which I can populate with items.
When adding items, a script (called soak), is activated and it goes through all the items in the armorlist and adds the sums together and allocates them to the correct place.
It works fine with an onInit function, and onValueChanged function, but when deleting an item, nothing happens.
I should say that onInit is placed in a window above the armorlist. And the onValueChanged is in the items I add to the armorlist. I had to do it like that to make the onInit to function.
Anyway, I think I need a handler function here. More specifically onChildDeleted. But I have no understanding of how they work.
And after going through the developer guide and forums, I think I found the solution, but I don't understand it at all.
This is what I have so far:
Code:
function onInit()
local nodeWin = getDatabaseNode();
DB.addHandler("inventorylist", "onChildDeleted", soak);
soak(nodeWin);
end
But this doesn't work. I need the soak function to run when an item is deleted. And now I don't know what the next step would be.
Any help or guidance would be greatly appreciated.