When modifying a tree through its model, the change (selection changed) event won’t always fire as it should. For example, if you delete the currently selected node the selection will change to null but no change event will be dispatched. In cases like this you have to dispatch the change event manually using the component’s dispatchEvent method. For example:
tree.dispatchEvent({target:tree, type:"change"});
In general it’s best to use the event dispatching framework to manually fire the event from the component as shown here as opposed to just invoking the handler(s) directly. That way you don’t have to worry about keeping track of what handlers are listening to the component. Also, manually invoking a handler will cause the handler code to see a different value for “this” than if the handler had been invoked by the event framework, which may produce unexpected results.
September 1, 2006 at 1:50 pm
Very good reading. Peace until next time.
WaltDe