Home › Forums › Autocomplete › Order by Date Descending not working
- This topic has 12 replies, 2 voices, and was last updated 5 years ago by Alexander Bautz.
-
AuthorPosts
-
-
November 15, 2019 at 09:57 #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,
ChrisAttachments:
-
November 18, 2019 at 21:38 #27678
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
-
November 19, 2019 at 07:46 #27686
Hi Alexander,
Thank you for your feedback, I’ll wait for the next version 🙂
BR,
Chris -
November 28, 2019 at 22:11 #27779
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
-
December 5, 2019 at 09:20 #27845
Hi Alexander,
Thank you for the information, I will try the new version.
Thank you very much and BR,
Chris -
December 5, 2019 at 09:43 #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
Attachments:
-
December 5, 2019 at 19:12 #27851
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
-
December 6, 2019 at 09:29 #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,
ChrisAttachments:
-
-
December 6, 2019 at 17:37 #27862
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:
-
December 6, 2019 at 17:42 #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 -
December 6, 2019 at 17:50 #27867
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
-
December 7, 2019 at 11:30 #27879
Hi Alexander,
I can confirm that the sorty by Date works now with the new version.
Thank you very much 🙂
BR,
Chris -
December 9, 2019 at 12:50 #27887
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
-
-
AuthorPosts
- You must be logged in to reply to this topic.