Skip to content

Recipes for BackboneJS that implement common patterns like pagination.

License

Notifications You must be signed in to change notification settings

theorm/backbone-recipes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backbone Recipes

A set of classes for backbone.js implementing common patterns that are frequently used in web applications. Example provided uses Twitter's Bootstrap framework.

Pagination

What's included:

  • Recipes.Views.Table - to easily render a table.
  • Recipes.Views.Pager - to go through next, previous, first, last and Nth pages.
  • Recipes.Views.SearchBox - to filter the collection that backs the table.
  • Recipes.Collections.PaginatedCollection - collection class that understands pagination and filtering.

A simple Twitter search that displays results in a paginated table would be implemented like this:

var collection = new App.Collections.TwitterSearch();
new Recipes.Views.Table({
    el: $("#table"),
    collection: collection,
    row_template: _.template("<td><img src='<%= profile_image_url %>'></img><br/>@<%= from_user %></td><td><%= text %></td>")
});
new Recipes.Views.Pager({
    el: $("#pager"),
    collection: collection
});
var search = new Recipes.Views.SearchBox({
    el: $("#search"),
    collection: collection
})
search.$("input").trigger("keyup");

And we get this:

Twitter search

About

Recipes for BackboneJS that implement common patterns like pagination.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published