incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Vangasse" <st...@boardshop.co.uk>
Subject RE: selectManyListbox issue
Date Mon, 05 Mar 2007 15:56:13 GMT
I've looked a little further into this and it looks like it might be a
bug in Trinidad. In SimpleSelectManyRenderer getSelectedIndices() method
an int array called indices is used to define the index of each value in
the selection list. The code works fine when the selection list and the
value list are in the same order, but when they are different it breaks
down. 

The indices array is passed to SimpleSelectManyListboxRenderer
encodeElementContent() method where assignment of the boolean selected
variable relies on the values in the array being in numerical order:



    int selectedCount = selectedIndices.length;
    int selectedEntry = 0;
    for (int i = 0; i < count; i++)
    {
      boolean selected = ((selectedEntry < selectedCount) && 
                          (i == selectedIndices[selectedEntry]));
      if (selected)
        selectedEntry++;

      SelectItem item = selectItems.get(i);
      SimpleSelectOneRenderer.encodeOption(
           context, arc, component, item, converter,
           valuePassThru, i, selected);
    }



When the selection list and the value list have different ordering the
values in the indices array are not in numerical order. The code then
misses selected elements and they are not rendered as selected. Is this
a bug?

Thanks,

Steve Vangasse



-----Original Message-----
From: Steve Vangasse [mailto:steve@boardshop.co.uk] 
Sent: 16 February 2007 17:19
To: adffaces-user@incubator.apache.org
Subject: tr:selectManyListbox issue

Is anyone else having issues with tr:selectManyListbox on the current
trinidad snapshot. It only renders one option as selected on a list
where there a multiple selections. Submitting the form with multiple
selections updates the model correctly but then renders just the one as
selected. 
 
    <tr:selectManyListbox label="#{msgs.deliveryZones}"
value="#{salesOrders$delivery$optionForm.crudObject.zones}"
required="true">
     <f:selectItems
value="#{salesOrders$delivery$deliveryUtils.zones}"/>
    </tr:selectManyListbox>
 
salesOrders$delivery$optionForm.crudObject.zones is a List of objects
and salesOrders$delivery$deliveryUtils.zones is a List of SelectItems
whose vales are the complete set of those objects.
 
Any ideas?
 
Thanks,
 
Steve Vangasse


Mime
View raw message