Skip to content

Instantly share code, notes, and snippets.

@wookiehangover
Created April 17, 2011 22:19
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 wookiehangover/924528 to your computer and use it in GitHub Desktop.
Save wookiehangover/924528 to your computer and use it in GitHub Desktop.
function populateList(context, $template, $list, refresh){
var items = $template.tmpl(context);
$list.empty().append(items);
if( refresh === true ) {
$list.listview('refresh');
}
}
$('#super-happy-template-link').live('click', function(e){
e.preventDefault();
$.mobile.changePage( '#team-list' );
});
$('#team-list').live('pagebeforecreate', function(e){
var $list = $('#members-list'),
$listPage = $('#team-list');
$list.empty();
$.getJSON('/example/groups.json')
.success(function(data){
populateList(data, $('#category-template'), $list, true);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment