Announcement

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

    Select Item not displaying items in sorted order

    Hi,

    We are using
    a) SmartClient Version: v9.1p_2014-05-15/Pro Deployment (built 2014-05-15)
    b) Testing using IE 11.0.9600.17126


    We are using a select Item

    siMtrStsActn = new SelectItem("some unique ID");
    siMtrStsActn.setShowTitle(false);

    siMtrStsActn.setValueMap(referenceList("EXO-APLN-GRPG", true));


    The referenceList methods returns a LinkedHashMap:


    and the values are:

    Key, Value
    -------------------
    "000" "All Applications"
    "010" "Costing"
    "020" "Freight"
    "030" "Order Processing"
    "040" "Scps"
    "050" "Sprice"
    "060" "Reservations"
    "070" "Purchasing"
    "080" "Inventory"
    "090" "Production"
    "100" "Certification"
    "110" "Shipping"
    "115" "Non-Conformance Reporting"
    "120" "Invoicing"
    "130" "Sales Analysis"
    "140" "Sales History"
    "150" "Inventory Planning"
    "160" "Accounts Payable"
    "170" "Accounts Receivable"
    "180" "General Ledger"
    "190" "Financial Mapping"


    I would expect that they would be displayed in the order that I supplied them. Instead, the values starting with "100", "Certification" right up to "190" "Financial Planning" are being displayed and then the values starting with "090" "Production" are being displayed.


    Can you please let me know what may be causing this?

    Thanks,
    Voula

    #2
    This behavior is caused by a change introduced in IE9 (and Chrome) where for..in iteration over a JavaScript object, the order of iteration over properties no longer follows the order of declaration, but *only* for properties that happen to be parsable as positive integers.

    Yes, this is very surprising and inconsistent. We were very vocal in protesting against this change. We still hope the behavior will eventually be reverted when the JavaScript language spec clarifies requirements in this area.

    The workarounds are:

    1. introduce any other character into the property name. A leading 0 would work, for example, if all entries have a leading 0.

    OR

    2. use optionDataSource instead of just a valueMap

    Comment

    Working...
    X