We use jQuery, jQuery, and the jQuery Wufoo APIs to display data from our forms using the following code:
<div id="people">
<ul>
<script id="attendeeTemplate" type="text/x-jquery-tmpl">
<li>
<h4>${Field1}</h4>
${Field3} minutes
</li>
</script>
</ul>
</div>
This works well, but we would like to limit it to displaying only the first 10 entries. Now it displays every entry in the database (sorted using JavaScript and the API below). Please note that we are trying to show only the top 10, sorted by the least number of minutes.
Here is the javascript:
<script>
function processEntries(data) {
$.each(data.Entries, function(entriesIndex, entriesObject) {
if (entriesObject.Field1 && entriesObject.Field3) {
$("#attendeeTemplate").tmpl(entriesObject).appendTo("#people ul");
}
});
};
$.wufooAPI.getEntries({
"callback" : processEntries,
"formHash" : "BLAH",
"sortID" : "Field3",
"sortDirection" : "DESC",
});
</script>
Any thoughts on how to limit it to the top 10 will be very useful!
source
share