Skip to main content

9.3/9.4 Dojo Combobox Usage Question

1 reply [Last post]
Joined: 2003-07-09
Points: 0


I am having difficulty figuring out how to use the 9.3/9.4 dojo combobox.

Scenario: Using NetBeans 5.5.1 and the jMaki plug in that I picked up this morning (alongo with a fresh install of 5.5.1). Using a new Web Application (not VWP) -with JSF framework.

Question 1: I first tried using something like is done in the tests:

However, options and selected show as errors in the editor, and if I right-click and choose jMaki the list of attributes does not show options or selected.

Question 2: So, I searched about to find out how to get the selected value saved to a managed bean property. Below is what I came up with. I set the button's onClick attribute to :jmaki.attributes.get('form1:comboBox1').saveState(); return false;" and my tag looks something like:

I added the countryService method to my managed bean to work with the saveState() method. I post this below.

I doubt very much this is the way to do it, as I would have to write a bit of javaScript to save off my values to a managed bean. How should it be done?

Question 3: If I have to do it the way I describe in Question 2, is there a way to use value for setting the values for the drop down list and service for saving the value?

Here is the countryService code

public void countryService(FacesContext context, AjaxResult result) {
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
// get the command
String command = request.getParameter("cmd");
if ("setValue".equals(command)) {
String value = request.getParameter("value");
log("country service set value " + value);
} else {
for (int loop=0; loop < countries.length; loop++){
result.append("[\"" + countries[loop] + "\",\"" + countryCodes[loop] + "\" ]");
if (loop < countries.length -1) result.append(",");

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-07-31
Points: 0

Hi Kris,

The .9.3 / .9.4 combobox did not have the model set up correctly. It's been fixed in jMaki .9.5

You can only use the service to fetch data asynchronously or use the value for inline data but not both.

The format for combo box data for jMaki .9.5 and on is listed at:

You are going to need something that ends up as :

{name : 'Alabama', label:'Alabama''},
{name: 'California', label:'California'},
{name: 'New York', label:'New York', selected : true},
{name: 'Texas', label:'Texas'}

this is an array of JavaScript objects instead of an array of arrays.

You could use the label as the name but it would be recommended t o have them differently.

Something like:

result.append("{label : \"" + countries[loop] + "\", name : \"" + countryCodes[loop] + "\" }");
// append a comma for everything but the last time.

Let us know if this does not work.