Home › Forums › Autocomplete › OrderBy in the CAML?
Tagged: autocomplete, OrderBy, Sort, Sorting
- This topic has 2 replies, 2 voices, and was last updated 8 years, 4 months ago by Alexander Bautz.
-
AuthorPosts
-
-
July 27, 2016 at 15:52 #12543
Hi I am trying to order my results in the autocomplete script. I have tried the below but although it works fine without the <OrderBy> in it, once I add orderby it stops working and doesn’t recognise the list its looking up from exists anymore. I have tried putting orderby at the front of the And and at the End, ive also tried encapsulating in a <Query> and also a <Where> but no joy on any of them, is the current CAML filter within AutoComplete limited without the ability to Sort or have I missed something? Thanks in advance.
spjs.ac.textField({ "applyTo":"EventName", "helpText":"Enter the event title...", "listGuid":"Events", "listBaseUrl":"/test", "showField":"Title", "enforceUniqueValues":true, "rowLimit":15, "listOptionsOnFocus":false, "reValidateOnLoad":false, "allowAddNew":false, "isLookupInSelf":true, "filterCAML":"<And><Geq><FieldRef Name='AvailableTickets'></FieldRef><Value Type='Number'>1</Value></Geq><Geq><FieldRef Name='Date'></FieldRef><Value Type='DateTime'><Today/></Value></Geq></And><OrderBy><FieldRef Name='Date' /></OrderBy>", "setFields":[ { "fromFIN":"Title", "toFIN":"EventName", "parseFunction":"", "skipIfEmpty":false }, { "fromFIN":"ID", "toFIN":"EventID", "parseFunction":"", "skipIfEmpty":false } ] }); </script>
-
July 29, 2016 at 09:54 #12577
Hi,
Currently the result is automatically ordered by the “showField” specified in the argument object. Specifying another OrderBy column is not supported.Can you give me some more information as to why you need to change the default alphabetical ordering?
Alexander
-
July 31, 2016 at 08:35 #12604
Cut from from email:
Hi Alex
I’m getting to order by date, the data in showing to the user is a concatenated field which is a string, am example would be
Manchester United v Hull 02/11/2016
The issue i have is because it’s text, so I was trying to order by another colum in the lookup list which is a date and time field
Thanks
Regards
Sergio GiustiI have added an option to specify the sort column. See change log here: https://spjsblog.com/dffs/dffs-change-log/
Please let me know how it works out.
Best regards,
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.