<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>page UI Component</title><link>https://community.telligent.com/community/13/w/api-documentation/75820/page-ui-component</link><description>&lt;p&gt;&lt;span&gt;Developing on Verint Community? Use the API documentation as a reference for all supported interactions with Verint Community.&lt;/span&gt;&lt;/p&gt;</description><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>page UI Component</title><link>https://community.telligent.com/community/13/w/api-documentation/75820/page-ui-component</link><pubDate>Fri, 08 Mar 2024 17:52:11 GMT</pubDate><guid isPermaLink="false">b71d1b7f-dc40-4979-8247-d8bb2f3667fb</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/13/w/api-documentation/75820/page-ui-component#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 03/08/2024 17:52:11&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;jQuery.telligent.evolution.ui.components.page&lt;/h3&gt;
&lt;p&gt;[[ui JavaScript API Module|UI Component]] which handles automatic presentation of a paging control. Transforms the output from &lt;code&gt;$core_v2_ui.Page()&lt;/code&gt;, which is a &lt;code&gt;&amp;lt;span class=&amp;quot;ui-page&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; stub. The default implementation uses the [[evolutionPager jQuery Plugin|evolutionPager plugin]]. [[ui JavaScript API Module|Overrides can be provided]] at the theme level to present paging differently, either by different usage of [[evolutionPager jQuery Plugin|evolutionPager plugin]] or by an entirely different paging UI.&lt;/p&gt;
&lt;h3&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;currentpage&lt;/code&gt;: Current page index&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pagesize&lt;/code&gt;: Items per page&lt;/li&gt;
&lt;li&gt;&lt;code&gt;totalitems&lt;/code&gt;: Total items&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pagekey&lt;/code&gt;: Pager-specific query string key to use for page numbers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pagedcontenturl&lt;/code&gt;: Optional ajax endpoint for retrieving paged content (for ajax paging)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pagedcontentwrapperid&lt;/code&gt;: Optional DOM id of an element to update with paged content retrieved from the ajax paging endpoint&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pagedcontentpagingevent&lt;/code&gt;: Optional name of a client message to raise when ajax paging is occurring&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pagedcontentpagedevent&lt;/code&gt;: Optional name of a client message to raise when ajax paging has completed&lt;/li&gt;
&lt;li&gt;&lt;code&gt;loadingindicator&lt;/code&gt;: When true, shows a loading indicator mask on the &lt;code&gt;pagedcontentpagingevent&lt;/code&gt;, hiding it on the &lt;code&gt;pagedcontentpagedevent&lt;/code&gt; event.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;loadonanyhashchange&lt;/code&gt;: When true, reloads the currently viewed page on any &lt;code&gt;hashchange&lt;/code&gt; when using ajax paging&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;configuration&lt;/code&gt;: Object of all other keys and values passed via the options dictionary to &lt;code&gt;$core_v2_ui.Page()&lt;/code&gt;, regardless of whether they have been pre-defined
&lt;ul&gt;
&lt;li&gt;
[[evolutionPager jQuery Plugin|jQuery.evolutionPager]] looks for the following optional configuration:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ShowPrevious&lt;/code&gt;: Whether &amp;#39;previous&amp;#39; links should be shown (default: &lt;code&gt;false&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ShowNext&lt;/code&gt;: Whether &amp;#39;next&amp;#39; links should be shown (default: &lt;code&gt;false&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ShowFirst&lt;/code&gt;: Whether &amp;#39;first&amp;#39; links should be shown (default: &lt;code&gt;true&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ShowLast&lt;/code&gt;: Whether &amp;#39;last&amp;#39; links should be shown (default: &lt;code&gt;true&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ShowIndividualPages&lt;/code&gt;: Whether individual pages should be shown (default: &lt;code&gt;true&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NumberOfPagesToDisplay:&lt;/code&gt;: Number of individual pages to show (default: &lt;code&gt;5&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Example&lt;/h3&gt;
&lt;p&gt;A barebones UI component override which would result in rendering the current page number with back and next links, and not performing any paging via Ajax regardless of whether a &lt;code&gt;pagedcontenturl&lt;/code&gt; was provided:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.ui.components.page = {
    setup: function() {
    },
    add: function(elm, options) {
        var message = &amp;#39;&amp;#39;,
            currentPage = parseInt(options.currentpage, 10)

        // show a previous link
        if(currentPage &amp;gt; 0) {

            // build a URL using the query string key
            var previousPageQuery = {}, previousPageHref;
            previousPageQuery[options.pagekey] = currentPage;
            previousPageHref = $.telligent.evolution.html.encode(
                $.telligent.evolution.url.modify({ query: previousPageQuery }));

            message = &amp;#39;&amp;lt;a href=&amp;quot;&amp;#39; + previousPageHref + &amp;#39;&amp;quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&amp;#39;;
        }

        // show current page
        message = message + &amp;#39;Page: &amp;#39; + (currentPage + 1);

        // show a next link
        if((currentPage + 1) &amp;lt; options.totalitems / options.pagesize) {

            // build a URL using the query string key
            var nextPageQuery = {}, nextPageHref;
            nextPageQuery[options.pagekey] = currentPage + 2;
            nextPageHref = $.telligent.evolution.html.encode(
                $.telligent.evolution.url.modify({ query: nextPageQuery }));

            message = message + &amp;#39;&amp;lt;a href=&amp;quot;&amp;#39; + nextPageHref + &amp;#39;&amp;quot;&amp;gt;Next&amp;lt;/a&amp;gt;&amp;#39;;
        }

        $(elm).html(message);
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&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($){

function showLoadingIndicator(container, mask) {
    var containerOffset = container.offset();
    mask.hide().appendTo(&amp;#39;body&amp;#39;).css({
        width: container.width(),
        height: container.height(),
        top: containerOffset.top,
        left: containerOffset.left
    }).show();
}

function hideLoadingIndicator(container, mask) {
    mask.hide();
}

function buildMask() {
    return $(&amp;#39;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;#39;).css({
        backgroundColor: &amp;#39;#fff&amp;#39;,
        position: &amp;#39;absolute&amp;#39;,
        opacity: .75,
        zIndex: 1
    });
}

var ajaxPagerContexts = {};
$.telligent.evolution.ui.components.page = {
    setup: function() {

    },
    add: function(elm, options) {
        // general settings
        var settings = {
            currentPage: parseInt(options.currentpage, 10),
            pageSize: parseInt(options.pagesize, 10),
            totalItems: parseInt(options.totalitems, 10),
            showPrevious: typeof options.configuration.ShowPrevious === &amp;#39;undefined&amp;#39; ? false : options.configuration.ShowPrevious === &amp;#39;true&amp;#39;,
            showNext: typeof options.configuration.ShowNext === &amp;#39;undefined&amp;#39; ? false : options.configuration.ShowNext === &amp;#39;true&amp;#39;,
            showFirst: typeof options.configuration.ShowFirst === &amp;#39;undefined&amp;#39; ? true : options.configuration.ShowFirst === &amp;#39;true&amp;#39;,
            showLast: typeof options.configuration.ShowLast === &amp;#39;undefined&amp;#39; ? true : options.configuration.ShowLast === &amp;#39;true&amp;#39;,
            showIndividualPages: typeof options.configuration.ShowIndividualPages === &amp;#39;undefined&amp;#39; ? true : options.configuration.ShowIndividualPages === &amp;#39;true&amp;#39;,
            numberOfPagesToDisplay: typeof options.configuration.NumberOfPagesToDisplay === &amp;#39;undefined&amp;#39; ? 5 : parseInt(options.configuration.NumberOfPagesToDisplay, 10),
            pageKey: options.pagekey,
            hash: options.configuration.Target,
            baseUrl: options.configuration.BaseUrl || window.location.href,
            template: typeof options.configuration.Template !== &amp;#39;undefined&amp;#39; ? options.configuration.Template : &amp;#39;&amp;#39; +
                &amp;#39; &amp;lt;% foreach(links, function(link, i) { %&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% if(link.type === &amp;quot;first&amp;quot;) { %&amp;gt; &amp;#39; +
                &amp;#39;         &amp;lt;a href=&amp;quot;&amp;lt;%: link.url %&amp;gt;&amp;quot; class=&amp;quot;first&amp;quot; data-type=&amp;quot;first&amp;quot; data-page=&amp;quot;&amp;lt;%= link.page %&amp;gt;&amp;quot; data-selected=&amp;quot;false&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;amp;#171;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% } else if(link.type === &amp;quot;previous&amp;quot;) { %&amp;gt; &amp;#39; +
                &amp;#39;         &amp;lt;a href=&amp;quot;&amp;lt;%: link.url %&amp;gt;&amp;quot; class=&amp;quot;previous&amp;quot; data-type=&amp;quot;previous&amp;quot; data-page=&amp;quot;&amp;lt;%= link.page %&amp;gt;&amp;quot; data-selected=&amp;quot;false&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;amp;#60;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% } else if(link.type === &amp;quot;page&amp;quot;) { %&amp;gt; &amp;#39; +
                &amp;#39;         &amp;lt;a href=&amp;quot;&amp;lt;%: link.url %&amp;gt;&amp;quot; class=&amp;quot;page&amp;lt;%= link.selected ? &amp;quot; selected&amp;quot; : &amp;quot;&amp;quot; %&amp;gt;&amp;quot; data-type=&amp;quot;page&amp;quot; data-page=&amp;quot;&amp;lt;%= link.page %&amp;gt;&amp;quot; data-selected=&amp;quot;&amp;lt;%= link.selected ? &amp;quot;true&amp;quot; : &amp;quot;false&amp;quot; %&amp;gt;&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;%= link.page %&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% } else if(link.type === &amp;quot;next&amp;quot;) { %&amp;gt; &amp;#39; +
                &amp;#39;         &amp;lt;a href=&amp;quot;&amp;lt;%: link.url %&amp;gt;&amp;quot; class=&amp;quot;next&amp;quot; data-type=&amp;quot;next&amp;quot; data-page=&amp;quot;&amp;lt;%= link.page %&amp;gt;&amp;quot; data-selected=&amp;quot;false&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;amp;#62;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% } else if(link.type === &amp;quot;last&amp;quot;) { %&amp;gt; &amp;#39; +
                &amp;#39;         &amp;lt;a href=&amp;quot;&amp;lt;%: link.url %&amp;gt;&amp;quot; class=&amp;quot;last&amp;quot; data-type=&amp;quot;last&amp;quot; data-page=&amp;quot;&amp;lt;%= link.page %&amp;gt;&amp;quot; data-selected=&amp;quot;false&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;amp;#187;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% } %&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% if(i &amp;lt; (links.length - 1)) { %&amp;gt; &amp;#39; +
                &amp;#39;         &amp;lt;span class=&amp;quot;separator&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;#39; +
                &amp;#39;     &amp;lt;% } %&amp;gt; &amp;#39; +
                &amp;#39; &amp;lt;% }); %&amp;gt; &amp;#39;
        };
        // ajax-specific options
        if(options.pagedcontenturl) {
            ajaxPagerContexts[options.pagedcontentpagingevent] = {
                onPage: function(pageIndex, complete, hash) {
                    var data = hash || {};
                    data[options.pagekey] = pageIndex;
                    // modify the url instead of passing as data, as the url might have this in the querystring already
                    var url = $.telligent.evolution.url.modify({ url: options.pagedcontenturl, query: data });
                    $.telligent.evolution.get({
                        url: url,
                        cache: false,
                        success: function(response) {
                            complete(response);
                        }
                    });
                }
            };
            $.extend(settings, {
                onPage: function(pageIndex, complete, hash) {
                    ajaxPagerContexts[options.pagedcontentpagingevent].onPage(pageIndex, complete, hash);
                },
                refreshOnAnyHashChange: (options.loadonanyhashchange === &amp;#39;true&amp;#39;),
                pagedContentContainer: &amp;#39;#&amp;#39; + options.pagedcontentwrapperid,
                pagedContentPagingEvent: options.pagedcontentpagingevent,
                pagedContentPagedEvent: options.pagedcontentpagedevent,
                transition: options.configuration.Transition,
                transitionDuration: typeof options.configuration.TransitionDuration === &amp;#39;undefined&amp;#39; ? 200 : parseInt(options.configuration.TransitionDuration, 10)
            });
        }
        $(elm).evolutionPager(settings);

        if(options.loadingindicator === &amp;#39;true&amp;#39;) {
            var container = $(&amp;#39;#&amp;#39; + options.pagedcontentwrapperid), mask = buildMask();
            $.telligent.evolution.messaging.subscribe(options.pagedcontentpagingevent, function(){
                showLoadingIndicator(container, mask);
            });
            $.telligent.evolution.messaging.subscribe(options.pagedcontentpagedevent, function(){
                hideLoadingIndicator(container, mask);
            });
        }
    }
};

}(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>