plastiq-sortable
sortable lists for plastiq
Last updated 5 years ago by refractalize .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install plastiq-sortable 
SYNC missed versions from official npm registry.

plastiq-sortable

Sortable lists for plastiq.

example

var plastiq = require('plastiq');
var h = plastiq.html;
var sortable = require('plastiq-sortable');

function render(model) {
  return sortable('li', model.items, function (item) {
    return h('li', item);
  });
}

plastiq.append(document.body, render, {items: [
  'red',
  'blue',
  'yellow'
]});

api

var sortable = require('plastiq-sortable');

var vdom = sortable(selector, [options], list, mapFunction);
  • selector - the selector to be passed to plastiq.html, i.e. 'li'.
  • options - the options to be passed to plastiq.html
  • options.moveItem(fromIndex, toIndex) - optional, called to move the item in list from fromIndex to toIndex. If not provided, the item is moved in item.
  • options.onitemmoved(item, fromIndex, toIndex) - called after an item in the list was moved.
  • list - the list of items from the model. Items in this list will be moved when the user sorts the list.
  • mapFunction(item) - a function taking an item from list, and producing the corresponding vdom.

Current Tags

  • 1.2.0                                ...           latest (5 years ago)

4 Versions

  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |