OrderBy doesn't work in Lookup

Home Forums SPJS-Lookup OrderBy doesn't work in Lookup

Viewing 2 reply threads
  • Author
    Posts
    • #23766
      Peter Giesselink
      Participant

        I’m using a lookup controlled by a choice field.
        The orderBy clause of the lookup function does not show the expected behavior.

        “fieldToConvertToDropdown”: [
        “VoertuigType”
        ],
        “listName”: “Voertuig type”,
        “optTextFieldInternalName”: “Title”,
        “pipeDelimitedOptions”: “false”,
        “optValFieldInternalName”: “ID”,
        “orderBy”: {
        “fin”: “Volgno”, // “Volgno” is an additional field in ‘Listname’ for sorting the records in ‘Listname’. Titles are unique in the list ‘Listname’ and carry digits inside the text which causes a unwanted sorting order.
        “ascending”: true
        },
        “clearInvalidSelections”: true,
        “filterObj”: {
        “on”: true,
        “folder”: “”,
        “CAML”: null,
        “fin”: “Merk”, / Choice column
        “isLookup”: false, // or true: doesn’t matter
        “operator”: “Eq”,
        “filterVal”: getFieldValue(“Merk”) // get selected value from the choice column ‘Merk’
        },

        Can anyone give a clue what is going wrong here?

      • #23775
        Alexander Bautz
        Keymaster

          Hi,
          Take a look at the customSort option: https://spjsblog.com/dffs/dffs-plugins/spjs-lookup/#customSort

          Alexander

          • #23778
            Peter Giesselink
            Participant

              It works fine, Thanks.

              But now I don’t understand the function of the orderBy clause. What is it suppose to do?

          • #23780
            Alexander Bautz
            Keymaster

              The “orderBy” option is used to alphabetically sort the options, but if you want to override this default sort method and write your own custom sort function you can supply it in the new “custsomSort” option.

              Alexander

          Viewing 2 reply threads
          • You must be logged in to reply to this topic.