users@woodstock.java.net

dojo endTopic events

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Fri, 06 Jun 2008 15:47:49 -0400

Hi,

When a dropdown is changed I make a busy indicator component visible and
call the value change listener on the server. I want to listen for the
refresh.endTopic event so that I can hide the busy indicator when the
request is completed.

I've read the TLD example and an other woodstock AJAX example which
helped me come up with this:

var processEvents = {
    update: function(props) {
        
document.getElementById('form1:progressBar1').setProps({"visible":false});
    }
}

// Subscribe to refresh event.
var domNode = document.getElementById("form1:dropDown1");
domNode.subscribe(domNode.event.refresh.endTopic, processEvents, "update");

I put that code in the method that is called by dropDown1's onChange.
I've also tried it outside of any function. The error I get is:
"domNode.subscribe is not a function".

I've also tried it like this (also from woodstock docs):

dojo.event.topic.subscribe(webui.suntheme.widget.dropDown.event.refresh.endTopic,
processEvents, "update");

and the error I get is: "dojo.event has no properties". Please forgive
me if this is a dumb question, but I am new to doing JavaScript stuff
and AJAX. I'll be reading a book on JavaScript soon.


Thanks,
Ryan