<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>searchresult UI Component</title><link>https://community.telligent.com/community/11/w/api-documentation/67190/searchresult-ui-component</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>searchresult UI Component</title><link>https://community.telligent.com/community/11/w/api-documentation/67190/searchresult-ui-component</link><pubDate>Tue, 19 Nov 2019 20:29:55 GMT</pubDate><guid isPermaLink="false">6f655cc5-0c15-4183-8014-bda31d442943</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67190/searchresult-ui-component#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/19/2019 20:29:55&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;&lt;a id="jQuery_telligent_evolution_ui_components_searchresult" name="jQuery_telligent_evolution_ui_components_searchresult"&gt;&lt;/a&gt;jQuery.telligent.evolution.ui.components.searchresult&lt;/h3&gt;
&lt;p&gt;[[ui JavaScript API Module|UI Component]] which handles automatic presentation and registration of search result items&amp;#39; dynamic behavior. Decorates &lt;code&gt;&amp;lt;div class=&amp;quot;ui-searchresult&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt; items to present Ajax-loaded search result details. [[ui JavaScript API Module|Overrides can be provided]] at the theme level to present search result items differently.&lt;/p&gt;
&lt;p&gt;This is primarily used by ISearchableContentType plugins to provide for ajax-fetched details (also provided by the plugins) to be dynamically loaded when the plugins&amp;#39; rendered search results are moused over.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Options" name="Options"&gt;&lt;/a&gt;Options&lt;/h3&gt;
&lt;p&gt;Data made available to instances of the component:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;detailsurl&lt;/code&gt;: Ajax endpoint URL for fetching extra search result details.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a id="Example" name="Example"&gt;&lt;/a&gt;Example&lt;/h3&gt;
&lt;p&gt;Given a search result rendered by &lt;code&gt;ISearchablContentType.GetViewHtml&lt;/code&gt; ...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&amp;quot;abbreviated-post ui-searchresult&amp;quot;
    data-detailsurl=&amp;quot;&amp;quot;&amp;gt;
    &amp;lt;div class=&amp;quot;post-metadata&amp;quot;&amp;gt;
        &amp;lt;ul class=&amp;quot;property-list&amp;quot;&amp;gt;
            &amp;lt;li class=&amp;quot;property-item date&amp;quot;&amp;gt;[CONTENT DATE]&amp;lt;/li&amp;gt;
            &amp;lt;li class=&amp;quot;property-item author&amp;quot;&amp;gt;
                &amp;lt;span class=&amp;quot;user-name&amp;quot;&amp;gt;
                    &amp;lt;a href=&amp;quot;[USER_PROFILE_URL]&amp;quot; class=&amp;quot;internal-link view-user-profile&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;
                        [USER NAME]
                    &amp;lt;/a&amp;gt;
                &amp;lt;/span&amp;gt;
            &amp;lt;/li&amp;gt;
            &amp;lt;li&amp;gt;
                &amp;lt;ul class=&amp;quot;details&amp;quot;&amp;gt;&amp;lt;/ul&amp;gt;
            &amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;h4 class=&amp;quot;post-name&amp;quot;&amp;gt;
        &amp;lt;a class=&amp;quot;internal-link view-post&amp;quot; title=&amp;quot;Test Wiki&amp;quot; href=&amp;quot;[CONTENT URL]&amp;quot;&amp;gt;[CONTENT NAME]&amp;lt;/a&amp;gt;
    &amp;lt;/h4&amp;gt;
    &amp;lt;div class=&amp;quot;post-summary&amp;quot;&amp;gt;[CONTENT SUMMARY]&amp;lt;/div&amp;gt;
    &amp;lt;div class=&amp;quot;post-application&amp;quot;&amp;gt;
        &amp;lt;a href=&amp;quot;[CONTENT APPLICATION URL]&amp;quot;&amp;gt;[CONTENT APPLICATION NAME]&amp;lt;/a&amp;gt;
        &amp;lt;a href=&amp;quot;[CONTENT CONTAINER URL]&amp;quot;&amp;gt;[CONTENT CONTAINER NAME]&amp;lt;/a&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;... and an Ajax callback&amp;#39;s response, potentially provided by the same plugin&amp;#39;s &lt;code&gt;IHttpCallback&lt;/code&gt;&amp;#39;s &lt;code&gt;ProcessRequest()&lt;/code&gt; ...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&amp;quot;property-item&amp;quot;&amp;gt;238 views&amp;lt;/li&amp;gt;
&amp;lt;li class=&amp;quot;property-item&amp;quot;&amp;gt;2 revisions&amp;lt;/li&amp;gt;
&amp;lt;li class=&amp;quot;property-item&amp;quot;&amp;gt;Latest: 12 May 2010&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;... then the response will be automatically rendered within &lt;code&gt;&amp;lt;ul class=&amp;quot;details&amp;quot;&amp;gt;&amp;lt;/ul&amp;gt;&lt;/code&gt; whenever the search result is moused over.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Default_Implementation" name="Default_Implementation"&gt;&lt;/a&gt;Default Implementation&lt;/h3&gt;
&lt;p&gt;For reference purposes or as the basis for an override:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(function($){

    var template = (&amp;#39;&amp;#39; +
&amp;#39;&amp;lt;% foreach(properties, function(property) { %&amp;gt; &amp;#39; +
&amp;#39;&amp;lt;li class=&amp;quot;property-item&amp;quot;&amp;gt;&amp;lt;%= property %&amp;gt;&amp;lt;/li&amp;gt; &amp;#39; +
&amp;#39;&amp;lt;% }); %&amp;gt; &amp;#39;),
        compiledTemplate = $.telligent.evolution.template.compile(template),
        getDetails = function(url, complete) {
            $.telligent.evolution.get({
                url: url,
                dataType: &amp;#39;json&amp;#39;,
                success: function(response) {
                    if(response) {
                        complete(formatDetails(response));
                    }
                }
            });
        },
        formatDetails = function(details) {
            return compiledTemplate(details);
        };

    $.telligent.evolution.ui.components.searchresult = {
        setup: function() {
        },
        add: function(elm, options) {
            if(options.detailsurl) {
                var details = null,
                    detailsList = elm.find(&amp;#39;ul.details&amp;#39;),
                    initialDetailsList = detailsList.html();
                elm.on(&amp;#39;mouseenter&amp;#39;, function(e){
                    if(details !== null) {
                        detailsList.html(details);
                    } else {
                        getDetails(options.detailsurl, function(response) {
                            details = response;
                            detailsList.html(details);
                        });
                    }
                }).on(&amp;#39;mouseleave&amp;#39;, function(e){
                    detailsList.html(initialDetailsList);
                });
            }
        }
    };

}(jQuery));
&lt;/code&gt;&lt;/pre&gt;

&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>