Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-999

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1.7-SNAPSHOT
    • None
    • InputSuggestAjax
    • None
    • Apache Tomcat/6.0.13, Eclipse Version: 3.2.2, Windows Vista, Firefox 2.0.0.3

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            milovdzee Milo van der Zee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: