Sorting SPJS Lookup in descending order

Home Forums SPJS-Lookup Sorting SPJS Lookup in descending order

Tagged: 

Viewing 6 reply threads
  • Author
    Posts
    • #20203
      Tony
      Participant

        Hi Alexander,

        I am using SPJS lookup to convert a textfield into a dropdown. The listed values in the dropdown are sorted in Ascending order. i need to make them appear in descending order.
        I tried to set the Ascending property in SPJS-lookup.js to False but it did not work.
        Any help from your side is really appreciated.

        Regards,

        Tony

      • #20231
        Alexander Bautz
        Keymaster

          Hi,
          I tested it and it works in my setup – what version of the spjs-lookup plugin are you running?

          Please note that false is written in lower case and without quotes like this:

          ...
          ...
          "orderBy": {
              "fin": "Title",
              "ascending": false
          },
          ...
          ...

          Alexander

          • #20244
            Tony
            Participant

              Below is my filterObj still not working. I am working on [SPJS-Lookup plugin 1.1.5]

              “filterObj”: {
              “on”: false,
              “folder”: “”, // Leave empty to search in all folders
              “CAML”: null, // If used, the rest of the filterObj settings are disregarded
              “fin”: “ActiveStatus”,
              “ascending”: false,
              “isLookup”: false,
              “operator”: “Neq”,
              “filterVal”: “Inactive”
              }

            • #20251
              Alexander Bautz
              Keymaster

                I see, the orderBy functionality was added in v1.1.8

                This means you must update to a later version.

                Alexander

            • #20256
              Tony
              Participant

                Thank you for your replies Alexander.
                I updated DFFS and now i have [SPJS-Lookup plugin v1.1.9]

                It is still not changing with the below code:
                “filterObj”: {
                “on”: false,
                “folder”: “”, // Leave empty to search in all folders
                “CAML”: null, // If used, the rest of the filterObj settings are disregarded
                “fin”: “ActiveStatus”,
                “ascending”: false,
                “isLookup”: false,
                “operator”: “Neq”,
                “filterVal”: “Inactive”
                }

                Setting the ascending to false or true is changing nothing. You mentioned the orderBy functionality and not the ascending property. Am i missing a parameter that i should use.

                Regards,

                Tony

              • #20284
                Alexander Bautz
                Keymaster

                  Hi,
                  The orderBy property is not part of the “filterObj” – look at this example to see where to add it: https://spjsblog.com/dffs/dffs-plugins/spjs-lookup/#Example_configuration

                  Alexander

                • #20309
                  Tony
                  Participant

                    HI,

                    Working as expected now. thanks again.

                    Regards,

                    Tony

                  • #25676
                    Taylor Scott
                    Participant

                      Hi Alex, I’m having a similar issue. My vlookup is running on : v2.2.129, I’m calling the init function successfully w/ no probs, but recently tried to add a sort order. If I leave everything alone (default sort = Title) and change ascending to false (as a test) it still won’t sort descending. If I try to supply a fin to replace title it ignores it completely. I’m passing an object “dd” to the function that calls init() and no matter what I do I can’t change sort order:

                      
                      
                      spjs.lookup.init({
                          "fieldToConvertToDropdown": [
                              dd.fieldName
                          ],
                          "listName": dd.listName,
                          "listBaseUrl": siteUrl,
                          "optTextFieldInternalName": dd.selectField,
                          "pipeDelimitedOptions": "false",
                          "optValFieldInternalName": "ID",
                          "orderBy": {
                              "fin": dd.sortOrder,
                              "ascending": true
                          },
                          "clearInvalidSelections": true,
                          "filterObj": {
                              "on": dd.filterObject.filterOn,
                              "folder": "",
                              "CAML": dd.filterObject.CAML,
                              "fin": dd.filterObject.fin,
                              "isLookup": false,
                              "operator": dd.filterObject.operator,
                              "filterVal": dd.filterObject.filterVal
                          },
                          "dropDownDefaultvalue": "",
                          "allowBlank":true,
                          "parseFunction": "",
                          "addYouOwnValue": {
                              "on": false,
                              "linkText": "Write your own value"
                          },
                          "addToExternalList": {
                              "on": false,
                              "customFunction": null,
                              "linkText": "Add new item",
                              "saveNewItemText": "Save new item"
                          },
                          "debug": false,
                          "customSort": ""
                      });

                      Can you help?

                    • #25696
                      Alexander Bautz
                      Keymaster

                        Hi,
                        You are absolutely right – It seems I have broken the orderBy functionality somewhere along the line. I have attempted a fix in the attached version – see if it works out.

                        Please note that you must clear the browser cache and ensure it lists as SPJS-Lookup v1.1.17 (the version number you refer to is for SPJS-vLookup and not SPJS-lookup).

                        Alexander

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