<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>ui JavaScript API Module</title><link>https://community.telligent.com/community/12/w/api-documentation/71654/ui-javascript-api-module</link><description>Developing on Verint Community? Use the API documentation as a reference for all supported interactions with Verint Community.</description><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>ui JavaScript API Module</title><link>https://community.telligent.com/community/12/w/api-documentation/71654/ui-javascript-api-module</link><pubDate>Fri, 15 Jan 2021 21:43:58 GMT</pubDate><guid isPermaLink="false">8d836221-9c27-4b54-9ccf-653930603a8e</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/12/w/api-documentation/71654/ui-javascript-api-module#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 01/15/2021 21:43:58&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;jQuery.telligent.evolution.ui&lt;/h3&gt;
&lt;p&gt;Implements the UI component framework, and exposes a few helper methods for calling it explicitly.&lt;/p&gt;
&lt;h3&gt;About the UI Component Framework:&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;What are UI components?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;UI components are simple JavaScript objects defined on the namespace &lt;code&gt;jQuery.telligent.evolution.ui.components&lt;/code&gt;. They are automatically invoked against any DOM elements matching a CSS class name of &lt;code&gt;ui-COMPONENTNAME&lt;/code&gt;, where &lt;em&gt;componentname&lt;/em&gt; matches a known UI component.&lt;/p&gt;
&lt;p&gt;For example, given an HTML snippet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;span class=&amp;quot;ui-car&amp;quot; data-make=&amp;quot;honda&amp;quot; data-model=&amp;quot;civic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And a pre-defined UI component named &lt;code&gt;car&lt;/code&gt;...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jQuery.telligent.evolution.ui.components.car = {
    setup: function() {
        // setup is called once per page if at least one element matches this component
    },
    add: function(elm, options) {
        // add is called for each unique instance of an element matching the component
        // elm is the matching element
        // options is an object containing all data attributes defined on the element
        $(elm).html(&amp;#39;Car: &amp;#39; + options.make + &amp;#39; &amp;#39; + options.model);
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then all instances of the span will be transformed on the client side to contain &amp;#39;Car: [make] [model]&amp;#39;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What purpose do they serve?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;UI components allow the server-side to render a non-UI-specific instruction for the client to implement rendering. This allows hard-coded Widget API extensions to emit UI instructions while still allowing a theme to define how that UI looks and behaves.&lt;/p&gt;
&lt;p&gt;Default implementations of the components are provided in Core, but they are designed to be overriden by themes as necessary.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Automatic Behaviors&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Additionally, UI components are invoked against all matching elements when the page is modified too, not only after the page first loads. This makes UI components an easy way to embed interactive behaviors in content without having to specifically bind to events or set up handlers.&lt;/p&gt;
&lt;h3&gt;Methods&lt;/h3&gt;
&lt;p&gt;These are not often needed, and are usually invoked internally. They can be invoked explicitly as necessary.&lt;/p&gt;
&lt;h4&gt;render&lt;/h4&gt;
&lt;p&gt;Invokes all currently-known UI components against the page or a given selection within the page.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;As rendering is typically performed automatically, this is rarely needed.&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// invoke currently-defined UI components against all matching elements in div.mydiv
jQuery.telligent.evolution.ui.render(&amp;#39;div.mydiv&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;suppress&lt;/h4&gt;
&lt;p&gt;Temporarily suppresses automatic rendering of ui-components for the duration of the method&amp;#39;s scope. Returns response of callback. Supports nested suppression.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// invoke currently-defined UI components against all matching elements in div.mydiv
jQuery.telligent.evolution.ui.suppress(function(){
    // DOM manipulation without automatic ui component rendering
});
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;defer&lt;/h4&gt;
&lt;p&gt;Defers rendering of UI components on &lt;code&gt;element&lt;/code&gt; until callback completes. Returns response of callback. Supports nested deferral. This is useful for improving performance when doing a lot of DOM manipulation that would otherwise also immediately trigger UI component rendering on manipuated items.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// invoke currently-defined UI components against all matching elements in div.mydiv
jQuery.telligent.evolution.ui.defer(element, function(){
    // DOM manipulation with deferred ui component rendering
});
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;data&lt;/h4&gt;
&lt;p&gt;Given an element, parses its &lt;code&gt;data&lt;/code&gt; attributes into an object. If an attribute exists named &lt;code&gt;data-configuration&lt;/code&gt;, it parses its assumed querystring-encoded values as a separate object, &lt;code&gt;options.configuration&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;As options are normally parsed by the UI component framework automatically, this is rarely needed.&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var data = jQuery.telligent.evolution.ui.data(elm);
&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>