Skip to content

<xmod:LoadFeedButton>

<xmod:LoadFeedButton> renders a push-button that fires an AJAX request to load an XMP feed when clicked. Unlike <xmod:LoadFeed>, which loads on page load, <xmod:LoadFeedButton> only loads when the user clicks. Use it for "Load More" or "Refresh" patterns, including infinite-scroll lists.

Requires jQuery

The hosting page must include jQuery.

Sibling variants

Example — Two buttons, one target

html
<div id="Content"></div>

<xmod:LoadFeedButton Text="Show Top Authors" FeedName="Top20Authors" Target="#Content"
    LoadingImageUrl="~/images/loading.gif" />
<xmod:LoadFeedButton Text="Show Top Crime Books" FeedName="Top20CrimeBooks" Target="#Content">
  <Field Name="GenreId" Value="20" />
</xmod:LoadFeedButton>

Example — Infinite paging

The button below loads 10 more authors and appends them to the existing list. The feed receives a LastId parameter, taken from the hidden span at the end of the last visible row.

html
<xmod:Template>
  <ListDataSource CommandText="SELECT TOP 10 AuthorId, FirstName, LastName FROM Authors" />
  <HeaderTemplate><ul id="AuthorsList"></HeaderTemplate>
  <ItemTemplate>
    <li>[[FirstName]] [[LastName]]<span style="display:none;">[[AuthorId]]</span></li>
  </ItemTemplate>
  <FooterTemplate>
    </ul>
    <xmod:LoadFeedButton Text="Show Next 10"
        FeedName="Authors_Chunked"
        Target="#AuthorsList"
        IDSelector="#AuthorsList li:last span"
        InsertMode="Append"
        InfinitePaging="True"
        LoadingImageUrl="~/images/loading.gif" />
  </FooterTemplate>
</xmod:Template>

Properties

PropertyValuesDefaultDescription
FeedName *stringFeed name as defined on the Manage Feeds page
Target *jQuery selectorThe element whose content is replaced or appended
TextstringCaption displayed on the button
InsertModeReplace Append PrependReplaceHow the loaded content is placed into the target
LoadingImageUrlURLImage shown in the target while the feed is loading. Tilde paths supported
LoadingCssClassstringCSS class(es) applied to the loading image
InfinitePagingTrue FalseFalseEnable infinite-scroll plumbing — the button passes LastId to the feed
IDSelectorjQuery selectorWhen InfinitePaging="True", locates the element holding the last record's ID
CssClassstringCSS class name(s)
StylestringInline CSS
WidthsizeWidth of the button
HeightsizeHeight of the button
ToolTipstringHover tooltip
VisibleTrue FalseTrueShows or hides the button

* Required property

Child Tags

TagRequiredDescription
<Field Name Value>optionalPass extra parameters to the feed — same surface as on <xmod:LoadFeed>. Add as many as needed

Property Details

  • InfinitePaging: When True, the button calls xmp_InfinitePaging (a helper registered automatically). The helper reads the inner text of the element matched by IDSelector and sends it to the feed as a LastId parameter. Pair with InsertMode="Append" and a feed that returns rows where AuthorId > @LastId to build a "Load More" pattern.

    The feed should set ContentType="text/html" and return only the rows (no surrounding header/footer markup) so they fit cleanly into the existing list.

Companion feed setup

Feeds consumed by Load Feed buttons should set ContentType="text/html" so the response slots into the page directly. See <xmod:LoadFeed> for full feed-side examples.