Announcement

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

    Upgrade from 13.0 to 14.1, SelectItem sorting issue

    Upgrade from 13.0p_2024_01_20 to 14.1_2026_01_05

    In 13.0 this code worked, properly sorting by value map String value. In 14.1 this code sorts by Integer key no mater what.

    Map<Integer, String> comboDataUseTypes = com.modius.opendata.commondataresources.client.enums.DataType.getComboMapI();

    final SelectItem fDataType = new SelectItem(FIELD_DATA_TYPE);
    fDataType.setName(FIELD_DATA_TYPE);
    fDataType.setTitle("Data Type");
    fDataType.setWidth("*");
    fDataType.setPickListWidth(130);
    fDataType.setValueMap(comboDataUseTypes);
    fDataType.setRequired(true);
    fDataType.setSortField(1); // sort by String value not by Integer key
    fDataType.setValue(defaultComboType);
    fDataType.setRedrawOnChange(true);

    One work around that I found is to convert value map to client only data source. This feels like a step back. Can you offer any better options? We have lots of these types of idioms.

    #2
    You're missing a lot of required information:

    1. what kind of DataSource

    2. DataSource definition (.ds.xml)

    3. what is the actual SQL engine used

    4. what's the data volume - as this effects whether the sort takes place on the client or server

    5. what SQL do you see generated

    6. when you did the upgrade, did you skip any steps or leave anything around? If you are still using config files (like framework.properties) from the older version, you could break lots of things

    The sort on a field with a valueMap will generally use the displayValue as you desire, which is actually pretty complicated because it involves generating a SQL "CASE" statement. This is a longstanding behavior, not a change. But you can break it in any of the places mentioned above, so we need more information.

    Comment


      #3
      Hi sdub,

      is there perhaps some code missing? IMHO you are telling the framework to sort the SelectItem pickList by column 1 – a list that only has one column, column 0. You are not setting pickListProperties to show more than one column. And I don't know if this would even work with a valueMap.

      Also, are your String values parseable as Numbers? If so, this might apply.

      I'd just go with a clientOnly DataSource.

      Best regards
      Blama

      Comment

      Working...
      X