CustomResults - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.9
Category
Reference Guide

This version of the results widget let the user choose its own layout. He has to implement the JavaScript callbacks of its choice to customize the layout of a reply, of a feed header, etc.

<div class="AFSWidget" title="CustomResults">
<script type="application/json">
AFSWidgetCustomResults = {
"replyCallback": "insertReply",
"noReplyCallback": "insertNoReply",
"feedHeaderCallback": "insertFeedHeader",
"tocHeaderCallback": "insertTocHeaderCallback",
"clusterHeaderCallback": "insertClusterHeaderCallback",
"overspillHeaderCallback": "insertOverspillHeaderCallback"
};
</script>
</div>

These function names (insertReply, insertFeedHeader, ...) must exist in the current window context. Each function when it is called received the DOM node to customize and a JSON object containing the data needed to handle this part of the layout.

function insertReply(element, reply)
{
$listItem = $(element);
$listItem.html('<h1>'+reply['title']+'</h1>');

// etc… }

There is an internal callback name named dump that cannot be used to define a user function. It is possible to use this feature to dump all the JSON objects handled by the associated callback.

<div class="AFSWidget" title="CustomResults">
<script type="application/json">
AFSWidgetCustomResults = {
"replyCallback": "dump"
};
</script>
</div>

This configuration insert the JSON dump of the content of each reply. etc.

CustomResults - Display the search results in fully custom layout

Parameter

Type

Card

Default

Description

tocHeaderCallback

String

Optional

N/A

User function called when a feed table of content can be displayed

feedHeaderCallback

String

Optional

N/A

User function called when a feed header can be displayed

clusterHeaderCallback

String

Optional

N/A

User function called when a cluster header can be displayed

overspillHeaderCallback

String

Optional

N/A

User function called when an overspill header can be displayed

noReplyCallback

String

Optional

N/A

User function called when no reply can be displayed

replyCallback

String

Optional

N/A

User function called when a reply can be displayed