dt-list

Δt list controller - async & dynamic templating engine

Δt dynamictemplate List Controller

This provides List handling support for asyncxml and Δt.

$ npm install dt-list
var List = require('dt-list').List; // server 
var List = dynamictemplate.List;   // browser 
 
function myTemplate(view) {
    var that = this;
    var items = new List;
    view.on('add', function (model) {
        items.push(that.$li(function () {
            this.$p(model.text);
        }));
    });
    view.on('insert', function (imodel) {
        items.insert(i, that.$li(function () {
            this.$p(model.text);
        }));
    });
    view.on('remove', function (i) {
        var el;
        if (typeof i === 'undefined')
            el = items.remove(i);
        else
            el = items.shift();
        if (el) el.remove();
    });
}

Example in detail.

Same api like Order but you don't have to give functions anymore, that does List for you. Just throw your Δt elements created with asyncxml into the List like your would throw values into javascripts Array.