ItemLabelMethod not handled correctly in nightly build of may 20, 2007
----------------------------------------------------------------------

                 Key: TOMAHAWK-999
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-999
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: InputSuggestAjax
    Affects Versions: 1.1.6-SNAPSHOT
         Environment: Apache Tomcat/6.0.13, Eclipse Version: 3.2.2, Windows 
Vista, Firefox 2.0.0.3
            Reporter: Milo van der Zee


When using the itemLabelMethod the list with suggested items functions 
correctly but the selected values is shown as an id in the input field.
Fix would be to change InputSuggestAjaxRenderer.java to contain the 
"idToRender" coding. For example:


...
        String idToRender = null;
        
                /* check if the user supplied a label method */
                if (inputSuggestAjax.getItemLabelMethod() == null)
                {
                        mainComponentRenderedValue = 
RendererUtils.getStringValue(context, inputSuggestAjax);
                        idToRender = clientId;
        }
                else
        {
            MethodBinding labelMethod = inputSuggestAjax.getItemLabelMethod();

            if (labelMethod != null)
            {
                Object valueObject = inputSuggestAjax.getValue();

                Converter converter = getRequiredConverter(context, 
inputSuggestAjax);

                label = (String) labelMethod.invoke(context, new 
Object[]{valueObject});

                                hiddenInputValue = 
converter.getAsString(context, inputSuggestAjax, valueObject);
                mainComponentRenderedValue = hiddenInputValue;
                
                idToRender = clientId + "_valueFake";
            }
        }
...

...
        StringBuffer buffer = new StringBuffer();

        buffer.append("dojo.addOnLoad(function() {\n")
              
.append(inputSuggestComponentVar).append(".textInputNode.name=\"").append(idToRender).append("\";\n")
              .append(inputSuggestComponentVar).append(".textInputNode.value = 
\"").append(mainComponentRenderedValue).append("\";\n")
              .append(inputSuggestComponentVar).append(".comboBoxValue.value = 
\"").append(mainComponentRenderedValue).append("\";\n")
              .append(inputSuggestComponentVar).append(".onResize();\n")
              .append("});\n");

        out.write(buffer.toString());

        out.endElement(HTML.SCRIPT_ELEM);
...

This helps. Problem remains with the use of extensions.widget.InputSuggestAjax 
instead of ComboBox. But I assume this is a work-in-progress. I just changed it 
bag in my local version.

MAG,
Milo van der Zee

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to