Skip to content

Instantly share code, notes, and snippets.

@woeldiche
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woeldiche/11253085 to your computer and use it in GitHub Desktop.
Save woeldiche/11253085 to your computer and use it in GitHub Desktop.
client-side template
var TN = TN || {};
TN.config = TN.config || {};
TN.config.list = TN.config.list || {};
TN.config.list.dropdown = TN.config.list.dropdown || {};
TN.config.list.dropdown['example-dropdown'] = {
template: "<% _(data.content).forEach(function(row) { <li><a class=\"media media--small\" href=\"#\"><div class=\"media__image leader--small\"><span class=\"img--icon img--medium\"><img src=\"<%= row.image.url %>\" width=\"<%= row.image.width %>\" height=\"<%= row.image.height %>\" alt=\"<%= row.image.alt %>\"></span></div><div class=\"media__body\"><div class=\"text-truncate\"><strong><%= row.payer %></strong></div><div class=\"text-truncate\"><%= row.accname %></div><div class=\"text-truncate\"><%= row.accnum %></div></div></a></li> }); %>",
ajaxurl: '@Model.AjaxUrl',
pageAction: 'append',
pageText: 'Show more',
startPage: 1,
rowsPerPage: 5
};
<script type="text/template" id="template_example">
<% _(accounts).forEach(function(row) { %>
<li>
<a class="media media--small" href="#">
<div class="media__image leader--small">
<span class="img--icon img--medium">
<img src="<%= row.image.url %>" width="<%= row.image.width %>" height="<%= row.image.height %>" alt="<%= row.image.alt %>">
</span>
</div>
<div class="media__body">
<div class="text-truncate"><strong><%= row.payer %></strong></div>
<div class="text-truncate"><%= row.accname %></div>
<div class="text-truncate"><%= row.accnum %></div>
</div>
</a>
</li>
<% }); %>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment