Alien-GvaScript

 view release on metacpan or  search on metacpan

doc/html/Paginator.html  view on Meta::CPAN

    parameters  : {param1: 'val1', param2: 'val2'},
    step        : 20
  }</pre>


    </div>
  </div>
  <div class="TN_node" id="DESCRIPTION">
    <h2 class="TN_label">DESCRIPTION</h2>
    <div class="TN_content">
      <p>Paginated data is a set of data that can be divided into differnent pages. 
It is best described as a list of items that overflow one page and best presented in several pages.
The Paginator Object is used in this case to manage retrieval (through AJAX Requests) and handling (through an onSuccess handler).
It also will take care of creating the navigation links (first, prev, next, last) and rendering them into provided container.
Navigation links are used for an on demand <i>page flipping</i>.</p>
<p>Data will be requested using an HTTP call to a provided URL.
Data Index and Size are decided using <code>INDEX</code> and <code>STEP</code> parameters respectively. 
It is up to you to make use of these parameters to decide on the items to display.</p>
  <div class="TN_node" id="Pagination_Parameters">
    <h3 class="TN_label">Pagination Parameters</h3>
    <div class="TN_content">
      <p>The Paginator Object will manage the 2 request parameters</p>
<ul>
<li><a name="item__code_INDEX__code__start_index_of_items_to_retrieve"></a><b><code>INDEX</code> start index of items to retrieve</b>
</li>
<li><a name="item__code_STEP__code___number_if_items_to_include_per_page"></a><b><code>STEP</code>  number if items to include per page</b>
<p>These two parameters would help you in deciding which part of the dataset to return.</p>
</li>
</ul>

    </div>
  </div>
  <div class="TN_node" id="Navigation_Links">
    <h3 class="TN_label">Navigation Links</h3>
    <div class="TN_content">
      <p>Navigation links are the icons used to navigate through pages (page flipping). Along with icons, a 
text with start-to-end index of displayed records / number of total records is displayed.</p>
  <div class="TN_node" id="HTML">
    <h4 class="TN_label">HTML</h4>
    <div class="TN_content">
      <pre>  &lt;div class="gva-paginatorbar"&gt;
    &lt;div title="Derni&#xe8;re page" class="last"/&gt;
    &lt;div title="Page suivante" class="forward"/&gt;
    &lt;div class="text"&gt;1 &#xe0; 11 de 115&lt;/div&gt;
    &lt;div title="Page pr&#xe9;c&#xe9;dente" class="back inactive"/&gt;
    &lt;div title="Premi&#xe8;re page" class="first inactive"/&gt;
  &lt;/div&gt;</pre>

<p>Note that the icons are aware if they should be active/inactive. An 'inactive' css classname would be set to differentiate.</p>

    </div>
  </div>
  <div class="TN_node" id="CSS">
    <h4 class="TN_label">CSS</h4>
    <div class="TN_content">
      <p>Easy customization of icons</p>
<p>By default, css classnames are prefixed by 'gva'.</p>
<p>This can be overloaded by a global js variable: CSS_PREFIX
if declared before the inclusion of this Library</p>
<pre>  .gva-paginatorbar {float:right;width:250px;}
  .gva-paginatorbar div {width:16px;height:16px;cursor:pointer;float:right;}
  .gva-paginatorbar div.first {background:url(page-first.gif) no-repeat top center;}
  .gva-paginatorbar div.last {background:url(page-last.gif) no-repeat top center;}
  .gva-paginatorbar div.back {background:url(page-prev.gif) no-repeat top center;}
  .gva-paginatorbar div.forward {background:url(page-next.gif) no-repeat top center;}
  .gva-paginatorbar div.inactive {cursor:default;opacity:0.25;filter:alpha(opacity=25);}
  .gva-paginatorbar div.text {text-align:center;width:140px;color:#4b34c5;font-size:10pt;}
  
  /* classname given to the list container while data is waiting to be loaded */
  .gva-loading {
    background:url(ajax_loading.gif) no-repeat center center;
    position:absolute;
    width:30px;height:30px;
    top:50%;left:50%;
  }</pre>


    </div>
  </div>

    </div>
  </div>

    </div>
  </div>
  <div class="TN_node" id="Programming_Interface">
    <h2 class="TN_label">Programming Interface</h2>
    <div class="TN_content">
        <div class="TN_node" id="Methods">
    <h3 class="TN_label">Methods</h3>
    <div class="TN_content">
        <div class="TN_node" id="new_GvaScript_Paginator">
    <h4 class="TN_label">new GvaScript.Paginator</h4>
    <div class="TN_content">
      <pre>  var paginator = new GvaScript.Paginator(
        url, 
        {opt1:"val1", opt2:"val2", ...}
  );</pre>

<p>Creates the object that controls pages navigation. Arguments are</p>
<ul>
<li><a name="item__code_url__code_"></a><b><code>url</code></b>
<p>URL used to retrieve pages content using HTTP request.</p>
</li>
<li><a name="item__code_options__code_"></a><b><code>options</code></b>
</li>
</ul>
<p>Options used to define and customize the Paginator object.</p>
<p>The Paginator object is returned as it might be useful for a programatic navigation of pages.</p>
<p>Available options are:</p>
<ul>
<li><a name="item_links_container__i__String_HTMLElement___i_"></a><b>links_container <i>(String|HTMLElement)</i></b>
<p>Element or an id of an HTML Element to render the navigation links into.</p>
<p>required.</p>
</li>
<li><a name="item_list_container__i__String_HTMLElement___i_"></a><b>list_container <i>(String|HTMLElement)</i></b>
<p>Element of an id of an HTML Element that is used to render the result of the pagination.
A 'gva-loading' classname is set to this container in the duration of page request.  Also ajax timeout and error messages
will be displayed in this container.</p>
<p>required.</p>
</li>
<li><a name="item_step__i__numeric___i_"></a><b>step <i>(numeric)</i></b>
<p>Number of items to display per page.  
This number would be the value of <code>STEP</code> (HTTP Request Parameter) that is transferred with pagination calls.</p>
<p>optional - defaulted to 20</p>
</li>



( run in 1.473 second using v1.01-cache-2.11-cpan-119454b85a5 )