Skip to main content

Coordinated Dropdown (combobox)

5 replies [Last post]
kutlerc
Offline
Joined: 2003-07-09

Hi,

I would like to have two dojo drop downs (comboboxes). When a value is selected from the first drop down, I would like the second drop down list to be refreshed based on the selection from the first drop down.

For example, if I select Hawaii from the first drop down (states), then the second drop down is populated to show all the counties for Hawaii. If I select California, then the second drop down shows all the counties for California.

I understand that I need to add a topic for drop down 1 and register drop down 2 as a listener, but I can't figure out what to put in the listener to make the list get refreshed.

Does anyone know how to do this?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kutlerc
Offline
Joined: 2003-07-09

> Hi,
>
> I have the some problem.
> @kutlerc: Do you have a solution for this problem?
> Can you post it here?

I solved the problem using plain old JSF components and dynamic faces: http://blogs.sun.com/divas/entry/coordinated_drop_down_lists

I am going to next try out the hack that hat27533 posted

el_perezoso
Offline
Joined: 2007-03-17

Hi,

I have the some problem.
@kutlerc: Do you have a solution for this problem?
Can you post it here?

Thanks
Chris

hat27533
Offline
Joined: 2006-03-16

Hi, I have found a hack that works for the dojo.combo:-

If you add a function to the component.js for the dojo.combo widget :-
this.refreshMe = function(data){
//alert("Time to refresh");
this.wrapper.setValue("");
this.wrapper.dataProvider.setData(data);

}

you can call it via publish and subscribe in glue.js :-

jmaki.listeners.your_topic = function(args){
var x = your_widget_id;
var data = go_get_your_data();// make sure correct object for widget
var wrapper = jmaki.getWidget(x);
wrapper.refreshMe(data);
}

gmurray71
Offline
Joined: 2003-07-31

We have a sample that will be coming out soon where events from a combo box drives another combobox.

This case I believe would be better handled by creating a single widget with a more logic built in to handle the interaction.

kutlerc
Offline
Joined: 2003-07-09

Greg,

This request is in response to several customer requests. I am interested in hearing more about this single widget that would better meet their needs. Sometimes they have 3 or more coordinated drop-downs.