0.1.10 • Published 9 years ago

gnd-dropdown v0.1.10

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

gnd-dropdown

A dropdown (as html select) component for Gnd.

It supports binding a collection to the options and a model to the current selection.

Install

npm install gnd-dropdown

Usage

In a nodejs server:

var Dropdrown = require('gnd-dropdown');

// Dropdown.build points to the directory with the files to server

// using connect / express
app.use(static(path.join(__dirname, Dropdown.build)))

In the client:

// simple collection
var dropdown = new Dropdown(myCollection, {
  selectedId: mySelectedId,
  parent: '#dropdown'
});
dropdown.render();

// binding the selected item id to some model property
var dropdown = new Dropdown(myCollection, {
  selection: {model: myModel, key: 'itemId'},
  parent: '#dropdown'
});
dropdown.render();

// Listen to changes
dropdown.on('selected:', function(item){
  console.log(item);
});

// Do something special when last element is deleted
dropdown.on('lastRemoved:', function(item){
  // ---
})
0.1.10

9 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

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

11 years ago