Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SelectItem - Multi-Value Issue

    SC_SNAPSHOT-2011-08-02/PowerEdition Deployment (built 2011-08-02)

    I have an application client that defines a form with a couple of multi-value select items. I am using the Smart GWT Server to handle the SQL CRUD operations and everything works as expected.

    My issue lies with the restoring of the select item so that it reflects the multi-values previously assigned.

    The data source field definition is below.

    Code:
    <field name="PURPOSE" title="Purpose" type="text" multiple="true" length="1024">
    	<valueMap>
    		<value>Time Course</value>
    		<value>Dose Curve</value>
    		<value>Tox Tolerance</value>
    		<value>Expression</value>
    		<value>Efficacy</value>
    	</valueMap>
    </field>
    The Dynamic Form logic that defines the select item field is below.

    Code:
    SelectItem tissueTypeItem = new SelectItem("PURPOSE", "Purpose");
    tissueTypeItem.setMultiple(true);
    tissueTypeItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
    tissueTypeItem.setShowTitle(true);
    Based on my prior experience working with multi-value select item, I added a method to my logic that gets fired after the dynamic form is loaded. This method takes the single text value "[Time Course, Dose Curve]" and extracts it into a String[] multiValues array object.

    The Developer Console log messages I captured to trace my logic seems to validate that the string array has been properly constructed.

    Code:
    12:22:25.669:XRP0:WARN:Log:multiValues.length = 2
    12:22:25.684:XRP0:WARN:Log:multiValues[0] = Time Course
    12:22:25.700:XRP0:WARN:Log:multiValues[1] =  Dose Curve
    The method assigns the multiValues to the select item via the following logic.

    Code:
    FormItem formItem = mExperimentForm.getItem("PURPOSE");
    SelectItem selectItem = (SelectItem) formItem;
    selectItem.setValues(multiValues);
    Unfortunately, the select item component is not honoring the updated values. Only the first option "Time Course" is shown as selected.

    I could use some advice on how I could resolve this or troubleshoot it further.

    Thanks

    #2
    Assuming nothing went wrong while copying and pasting, there appears to be a blank space in front of "Dose Curve". The value you are applying might be " Dose Curve" instead.

    Comment


      #3
      Wow - I am embarrassed that I missed that!

      It works fine now that I added the string trim method to the logic. Thanks for the careful review and recommended solution.

      Comment

      Working...
      X