0.1.4 • Published 10 years ago

dt-list v0.1.4

Weekly downloads
3
License
-
Repository
github
Last release
10 years ago

Δt dynamictemplate List Controller

This provides List handling support for asyncxml and Δt.

Installation

$ npm install dt-list

Usage

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 (i, model) {
        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.

api

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.

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago