Socket
Book a DemoInstallSign in
Socket

gnd-dropdown

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gnd-dropdown

A Gnd dropdown component

latest
Source
npmnpm
Version
0.1.10
Version published
Maintainers
2
Created
Source

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){
  // ---
})


Keywords

gnd

FAQs

Package last updated on 04 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts