Skip to main content

Listener for dropdowndatepicker

3 replies [Last post]
sine_morbo
Offline
Joined: 2007-04-18

I'm trying to create a listener in glue.js for the dropdownconatainer widget. This is my code:
**glue.js**
jmaki.listeners.handleDropdowndatepicker = function(args) {
alert("glue.js : Dropdowndatepicker event");
}
// map topic dojo/datepicker to fisheye handler
jmaki.addGlueListener("/dojo/dropdowndatepicker*", "jmaki.listeners.handleDropdowndatepicker");

**JSF page**

The listener method doesn't get called, but the sample with fisheye widget works perfetly. Am I missing something?

Peter

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tigerfarm
Offline
Joined: 2006-11-28

Sample working code for dropdowndatepicker:
In Index.jsp:
...

Departure date:
Arrival date:

...
<div id="msgCall-1">Debug message 1.</div>
...

In glue.js:
jmaki.addGlueListener({topic : "/dojo/dropdownDatePicker",action: "call", target: { object: "jmaki.glue",functionName: "eventDropdownDatePicker"}});

jmaki.glue = {
eventDropdownDatePicker : function(args) {
alert("Event id: "+args.id+", value="+args.value);
document.getElementById('msgCall-1').innerHTML = "Event id: "+args.id+", value="+args.value;
}
}

For complete working NetBeans project, download and unzip: https://tigerfarm.dev.java.net/files/documents/6314/59437/Projects-jmaki...
Project name: jMakiGlue1

For complete project instructions, goto: http://blogs.sun.com/tiger/entry/web_2_0_ajax_dojo

sine_morbo
Offline
Joined: 2007-04-18

Thanks for your replies!

carlavmott
Offline
Joined: 2005-02-10

HI Peter,

The topic name in the listener doesn't match the topic name the widget is publishing too.

The topic name for drop down date picker is: /dojo/dropdownDatePicker

To figure out the topic names the widgets publish to see the following page:
https://ajax.dev.java.net/docs/jmdocs/index.html

Alternatively, you can override the topic names so that you will know what the name is as follows:


The widget will use this value instead, also make sure your glue code uses this topic name.

You may also find the logging console useful when debugging events. In the jmaki.js file you will find 2 variables this.debugGlue and this.debug set both to 'true' and a small console will appear in the page. Each time an event is published a message is posted. It includes the topic name and payload that was sent. It also indicates if there is a listener for the topic.

hope this helps.

carla