This page last changed on Sep 12, 2011 by kristin.bradley@involver.com.

Overview

Renders an anchor tag that, when clicked, loads a partial.


Configuration

Requires a partial to be defined using the partial tag.


Caching Considerations


Attributes

name type required description
partial string true Name of the partial to be rendered
container string true HTML ID attribute of the DOM element that will receive the partial
name string false A context variable where <name> is the name of the variable and the value is the value of the variable
class string false The class attribute for the ajax link
style string false The style attribute for the ajax link
onclick string false The handler for javascript code on every click of the ajax link
onfirstclick string false Same as onclick, except the javascript is only executed on the first click of the ajax link

Examples

Simple Example

Generates a link that will load in the paginated rss_feed:

{% partial name:'lazy_partial' %}
    {% rss_feed %}
        {% paginate rss_feed.feed_items per_page:5 %}
            {% for item in feed_items %}
                {{ item.title }}<br>
            {% endfor %}
        {% endpaginate %}
    {% endrss_feed %}
{% endpartial %}

<!-- this generates a link that will load the rss feed represented in the above partial -->
{% ajax_link partial:'lazy_partial' container:'rss_container'%}load rss feed{% endajax_link %}

<div id="rss_container">
    <!-- this container will be populated with the rss feed -->
</div>

Complex Example

You can pass in local context variables that will be available to the partial:

{% partial name: 'feed_partial' %}
    {% for item in feed.feed_items %}
        {{ item.title }}<br>
    {% endfor %}
{% endpartial %}

<div class="feed-box top-feed">
    {% rss_feed name:'feed1' %}
        {% ajax_link partial:'feed_partial' container:'rss_container' feed: rss_feed %}load feed1{% endajax_link %}
    {% endrss_feed %}
</div>

<div class="feed-box bottom-feed">
    {% rss_feed name:'feed2' %}
        {% ajax_link partial:'feed_partial' container: 'rss_container' feed: rss_feed %}load feed2{% endajax_link %}
    {% endrss_feed %}
</div>

<div id="rss_container"></div>

FAQ

This FAQ has no questions yet.


Related Topics

Document generated by Confluence on Feb 12, 2013 09:09