Events when expanding or collapsing a tree node

Clay Helberg shows how to listen for the "DOMSubTreeModified" in order to capture tree node expand/collapse Last Updated: 2006-10-27

Expanding or collapsing a tree node should change the expanded attribute on that node, which should trigger a DOMSubTreeModified event. If you attach a listener for that event to the tree control, you should be able to capture those events and do something with them. Here's a little test code I threw together to verify that it works:

      Application.alert("Subtree modified:" + Application.event.target.getAttribute("id"));

In a follow-up posting, Clay writes:

I know what you mean about not being sure which events will work. It would definitely be helpful to have some more sophisticated examples (e.g. that don't just use DOMActivate) in the customizer's guide. I've used some trial and error in the past, and it seems as if the DOM methods are pretty reliable for most controls--as long as you get the listener attached to the right control (which sometimes takes a bit of trial and error itself). I know the mouse events don't work at all with XUI (alas!)--they attach to the document in the Editor view (if at all) rather than the rendered controls in the dialog. I've also run into a few instances where you don't get events because the thing that should trigger the event doesn't happen. For example, selecting a row in a table doesn't trigger a DOMAttrModified event for the element, but it's not because there's a problem with event generation--it's because the attribute doesn't change!

(This is all based on Epic 5.0c, some of this may have changed in more recent versions...)

(Editor's note by Karl Johan Kleist: I changed the namespace attribute of the window element in the example from xmlns:ev="http://www.w3c.org/2001/xml-events" to  xmlns:ev="http://www.w3.org/2001/xml-events" (see "...\doctypes\xui\xui-1.0.dtd" for an explanation))