Last Updated: February 25, 2016
·
3.007K
· sspross

Django + Tastypie + Backbone.js = TastyBackbonePie

jQuery plugin to create ajax data tables using a django-tastypie api backend. Includes a way to easily paginate, sort and filter tables too.

Picture

https://github.com/sspross/tastybackbonepie

var book_table_settings = {
    uid: 'book_table',
    root_url: '/api/v1/book/',
    fields: [
        {
            'key': 'id',
            'label': '#',
        },
        {
            'key': 'name',
            'label': 'Name',
            'order_by': 'name',
        },
        {
            'key': 'added',
            'label': 'Added at',
            'order_by': 'added',
        },
        {
            'key': 'read',
            'label': 'Read',
            'template': '<% if (entry.get(\'read\') == true) { %>x<% } %>',
            'order_by': 'read',
        },
    ],
    additional_html_fields: [
        '<a class="btn btn-mini" href="#" data-id="<%= entry.get(\'id\') %>"><i class="icon-trash"></i></a>',
    ]
};

var book_table = $('#book-table').renderTastyBackbonePieTable(book_table_settings);