Order by Date Descending not working

Forums Autocomplete Order by Date Descending not working

Viewing 11 reply threads
  • Author
    Posts
    • #27662

      Hi Alexander,

      I’m encountering a problem with the Autocomplete Plugin regarding sorting the items:
      I want to sort by a column “Datum” which is a DatTime column descending, but the entries are sorted ascending even though I’ve set ascending to false in the configuration.

      Here is the configuration:

      spjs.ac.textField({
      “applyTo”:”Suche_x0020_Presseaussendung”,
      “helpText”:”Geben Sie den Titel der Presseaussendung ein”,
      “loadText”:”Presseaussendungen werden gesucht…”,
      “listGuid”:”Presseaussendungen”,
      “listBaseUrl”:”/ecpsharepoint”,
      “showField”:”SucheTitel”,
      “searchFields”:[],
      “filterCAML”:””,
      “useREST”:false,
      “optionDetailsFields”:[],
      “optionDetailsPrefix”: [],
      “enforceUniqueValues”:false,
      “rowLimit”:15,
      “listOptionsOnFocus”:false,
      “reValidateOnLoad”:false,
      “allowAddNew”:false,
      “addNewAdditionalFields”: [],
      “isLookupInSelf”:false,
      “multiselect”:false,
      “multiselectSeparator”:”; “,
      “minLengthBeforeSearch”:1,
      “orderBy”:[{“fin”:”Datum”,”ascending”:false,”numeric”:false}],
      “clearSetFieldsOnInvalidSelection”:false,
      “setFields”:[
      {
      “fromFIN”:”ID”,
      “toFIN”:”PresseaussendungID”,
      “parseFunction”:””,
      “skipIfEmpty”:false
      }
      ],
      “debug”:false
      });

      However, the entries are sorted Ascending in the Autocompleter whenever I perform a search.

      Am I missing something here ?

      Thank you very much in advance.

      BR,
      Chris

      Attachments:
    • #27678
      Alexander Bautz
      Keymaster

      Hi,
      Sorting on a date field is not currently supported (and there is also a bug that prevents sorting on a field that is not visible in the “viewField” or “optionDetailsFields”).

      I’ll fix the bug and add support for using a parseFunction in the orderBy section to let you sort on a date field in the next version. This will most likely not sometime next week.

      Alexander

    • #27686

      Hi Alexander,

      Thank you for your feedback, I’ll wait for the next version 🙂

      BR,
      Chris

    • #27779
      Alexander Bautz
      Keymaster

      You can check out the new version here: https://spjsblog.com/2019/11/28/dffs-package-updated-to-v4-4-4-16/

      I have also added an example in the user manual here: https://spjsblog.com/dffs/dffs-plugins/spjs-autocomplete/#orderBy

      Alexander

    • #27845

      Hi Alexander,

      Thank you for the information, I will try the new version.

      Thank you very much and BR,
      Chris

    • #27847

      Hi Alexander,

      Unfortunately it is still not working.

      I’ve added the function as mentioned in the user manual as you can see in the screenshot.

      However, I get an error in the console and the spinner turns forever and returns no results (2nd Screenshot)

      Am I missing something here ?

      Thank you very much and BR,

      Chris

    • #27851
      Alexander Bautz
      Keymaster

      From the error it looks like the value that is passed to the function is not correct – try looking at “str” when you stop at the debugger – what does it show?

      Alexander

      • #27859

        Hi Alexander,

        str = undefined is the value of str. (see attached screenshot)

        Do I have to pass a parameter in the parse function ?

        Thank you very much and BR,
        Chris

    • #27862
      Alexander Bautz
      Keymaster

      You are right. I did not test that properly for all possible options (REST vs webservice). I’ll get it fixed during the weekend and publish an updated version.

      In the meantime you can try the attached version (rename it to .js and replace the one you have in /DFFS/plugins).

      Alexander

      Attachments:
      1. SPJS-ac.js.txt
    • #27865

      Hi Alexander,

      Alright Thank you very much, I will try IT with the attached Version then and will appky the fixed Version next week.

      Thank you very much and have a nice weekend.

      BR,
      Chris

    • #27867
      Alexander Bautz
      Keymaster

      The attached version is actually the fixed one that I plan to release during the weekend so please let me know if it works or not.

      Alexander

    • #27879

      Hi Alexander,

      I can confirm that the sorty by Date works now with the new version.

      Thank you very much 🙂

      BR,
      Chris

    • #27887
      Alexander Bautz
      Keymaster

      Thanks for the feedback. I’ll release a new version of the DFFS package – including the file you already have updated – when I have sorted out one other possible bug.

      Alexander

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