Code for sort ASC not working
Can someone more skilled than me please look at this and tell me what I've gotten wrong?
{{{<unit relativeTo="ca_entities_x_entities" delimiter="<br/>"><unit relativeTo="ca_entities" sort="ca_entities.preferred_sort_term.sort_term_text" sortDirection="ASC"><l>^ca_entities.preferred_sort_term.sort_term_text%toUpper : : ^ca_entities.preferred_labels.displayname</unit>}}}
I'm trying to use the metaelement ca_entities.preferred_sort_term.sort_term_text to sort a return of related names. The element displays, but the sort does not happen. I attach image to show the results of Related Names, which are obviouly not displaying in alphabetic order.
Any guidance would be appreciated.
Mark
Comments
Hi Mark,
It seems that you have a mix of two
<unit>
. Also, I prefer useca_entities.related
instead ofca_entities_x_entities
.Try this:
{{{<unit relativeTo="ca_entities.related" delimiter="<br/>" sort="ca_entities.preferred_sort_term.sort_term_text" sortDirection="ASC"><l>^ca_entities.preferred_sort_term.sort_term_text%toUpper : : ^ca_entities.preferred_labels.displayname</l></unit>}}}
In my case, this works fine.😉
Many many thanks to you. It works! And I attach an image here to show the results. Now if I can just figure out how to show the sort term inside the hierarchical browser.
Hi,
Do you mean, in the Browse menu?
Could you copy/paste the content of your
pawtucket/themes/<your theme>/conf/browse.conf
here?You should insert into the
entities = { ... }
something like:If you want to show a Letter Bar in alphabetical order at the top, you should insert this inside
entities = { ... }
:Here's the browse.conf code:
cache_timeout = 0
#
#
#
browseTypes = {
objects = {
displayName = _(Objects),
labelSingular = _("object"),
labelPlural = _("objects"),
table = ca_objects,
restrictToTypes = [],
dontExpandTypesHierarchically = 1,
availableFacets = [],
# formats available for display of results
# possible values are: images, list, timeline, map
views = {
images = {},
list = {},
map = {
data = ca_objects.georeference,
width = 100%,
height = 600px,
minZoomLevel = 2,
maxZoomLevel = 18,
display = {
labelTemplate = <l>^ca_objects.preferred_labels.name</l> (^ca_objects.idno),
contentTemplate = <div style='float:left; margin:0px 10px 10px 0px;'>^ca_object_representations.media.icon</div><p>^ca_objects.description</p>
}
},
timeline = {
data = ca_objects.creation_date,
display = {
title_template = <l>^ca_objects.preferred_labels.name</l> (^ca_objects.idno),
description_template = <p>^ca_objects.description</p>,
credit_template = ^ca_objects.rightsStatement.rightsStatement_text,
caption_template = <em>^ca_objects.caption</em>,
image = ^ca_object_representations.media.small,
icon = ^ca_object_representations.media.icon
}
}
},
sortBy = {
Identifier = architectural_drawing_object.display_sort_category,
Title = ca_object_labels.name
},
# --- default sort direction for the sortBy options
sortDirection = {
Identifier = asc,
Title = desc
},
# --- sortControlType = dropdown or list
sortControlType = dropdown,
# options = {
# selectMediaUsingRelationshipTypes = [relationshipType],
# selectMediaUsingTypes = [objectType],
# extendedInformationTemplate = ^ca_objects.description
# }
},
collections = {
displayName = _(Collections),
labelSingular = _("collection"),
labelPlural = _("collections"),
table = ca_collections,
restrictToTypes = []
# formats available for display of results
# possible values are: images, list, timeline, map
views = {
images = {},
list = {}
},
sortBy = {
Relevance = _natural,
Identifier = ca_collections.idno,
Name = ca_collection_labels.name
},
# --- sortControlType = dropdown or list
sortControlType = dropdown
},
entities = {
displayName = _(People/Orgs),
labelSingular = _("person"),
labelPlural = _("people"),
table = ca_entities,
restrictToTypes = [],
showLetterBarFrom = ca_entity_labels.surname,
showLetterBarSorts = [ca_entity_labels.surname;ca_entity_labels.forename],
# formats available for display of results
# possible values are: images, list, timeline, map
views = {
images = {},
list = {}
},
sortBy = {
Relevance = _natural,
Identifier = ca_entities.idno,
Name = ^ca_entities.preferred_sort_term.sort_term_text;ca_entity_labels.forename
},
# --- sortControlType = dropdown or list
sortControlType = dropdown,
# options = {
# selectMediaUsingRelationshipTypes = [relationshipType],
# selectMediaUsingTypes = [objectType]
# }
},
occurrences = {
displayName = _(Works),
labelSingular = _("work"),
labelPlural = _("works"),
table = ca_occurrences,
restrictToTypes = [],
showLetterBarFrom = ca_occurrence_labels.name,
showLetterBarSorts = [ca_occurrence_labels.name],
# formats available for display of results
# possible values are: images, list, timeline, map
views = {
list = {}
},
sortBy = {
Relevance = _natural,
Identifier = ca_occurrences.idno,
Name = ca_occurrence_labels.name
},
# --- sortControlType = dropdown or list
sortControlType = dropdown,
# options = {
# selectMediaUsingRelationshipTypes = [relationshipType],
# selectMediaUsingTypes = [objectType]
# }
}
}
views = {
images = {
icon = glyphicon-th
},
list = {
icon = glyphicon-list
},
timeline = {
icon = glyphicon-time
},
map = {
icon = glyphicon-globe
}
}
# --- text for Browse menu item, default is "Browse"
browse_menu_button_text =
# --- default number of results per page/ajax load
defaultHitsPerBlock = 36
# --- set to list to show dropdown with links to each configured browse or a single Browse nav link when one browse is configured
browseMenuFormat =
# --- set if you don't want the browse menu to be preloaded with facets for the first browse type on open
dontPreloadBrowseMenu = 1
# --- refine_col_class -> boostrap col class to assign to refine col - defaults to: col-sm-8 col-md-8 col-lg-8
result_col_class =
# --- refine_col_class -> boostrap col class to assign to refine col - defaults to: col-sm-4 col-md-3 col-md-offset-1 col-lg-3 col-lg-offset-1
refine_col_class =
Hi, so try to replace the
entities = { ... }
block by:I've just removed the lines:
and added
Note that you must not add the "
^
" beforeca_entities.preferred_sort_term.sort_term_text
.