Coder Social home page Coder Social logo

0-t-0 / angular2-dual-listbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from czeckd/angular-dual-listbox

0.0 1.0 0.0 28 KB

Angular 2 component for a dual listbox control.

License: MIT License

TypeScript 67.57% CSS 9.31% HTML 12.45% JavaScript 10.68%

angular2-dual-listbox's Introduction

angular2-dual-listbox

The dual-listbox supplies two lists side-by-side that allows items in one list to be moved to the other list via drag-and-drop and/or a button-based interface. It supports multiple select options from the list and programatic setting of list sources.

The dual-listbox consists of a single file: (app/dual-list.component.ts) and can be used in conjuction with Bootstrap and the provided CSS style sheet (css/record-picker.css) for presentation.

Demo

A working demo shows the dual listbox in action.

Usage

Copy dual-list.component.ts into your app and add DualListComponent to the desired component's directives array. Additionally, add the record-picker.css to your app's index.html. See index.html for an example.

The following parameters can be set on a dual-list:

  • key - The unique identifier field of each object in the source and destination arrays, default is _id.
  • display - The field of each object for displaying the object each the lists, default is _name.
  • height - The height of the lists, default is 100px.
  • sort - A boolean whether or not to keep the lists sorted, default is false.
  • compare - A compare function to be used for sorting the lists. Note if sort is not set and compare is set, then sort will be set true.
  • source - The source array of objects for the list.
  • destination The destination array of objects selected from the list. Note, the destination array can have prexisting elements.

For a usage example, see demo-app.component.ts.

Known issue

The drag-and-drop between multiple dual-listbox components may cause undesired moves. For the time being, if the component is used, then it is recommended only have one dual-listbox visable to the user at a time.

Getting started

  1. Clone this repo
  2. Install the dependencies:
    npm install
    
  3. Run the TypeScript transpiler and start the server:
    npm start
    

License

MIT

Author

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.