Skip to content

skratchdot/react-bootstrap-multiselect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4153ef3 · Sep 16, 2015

History

41 Commits
Feb 20, 2015
Sep 16, 2015
Apr 3, 2015
Sep 16, 2015
Nov 19, 2014
Jul 24, 2014
Jul 22, 2014
Nov 19, 2014
Jul 22, 2014
Jul 3, 2015
Aug 25, 2015
Sep 16, 2015

Repository files navigation

react-bootstrap-multiselect

NPM version Dependency Status devDependency Status

Description

A multiselect component for react (with bootstrap). This is a react port of:

bootstrap-multiselect

Getting Started

  1. Install the module with: npm install --save react-bootstrap-multiselect

  2. Create your module (you need to use something like browserify to build)

var React = require('react');
var Multiselect = require('react-bootstrap-multiselect');
var someReactComponent = React.createClass({
    render: function () {
        return (
            <Multiselect />
        );
    }
});
  1. Include the multi-select CSS in your project somewhere. The CSS file is here: bootstrap-multiselect.css (don't hotlink- download and host your own copy)
<link rel="stylesheet" href="bootstrap-multiselect.css" type="text/css" />

Note on data synchronization

In case this.state.myData changes from outside of multiselect component, values and checkbox state will not update automatically. If you want to sync state, you have to call .syncData() on multiselect like in example below.

var React = require('react');
var Multiselect = require('react-bootstrap-multiselect');

var someReactComponent = React.createClass({
    getInitialState: function(){
        var that = this;
        $("element").on("event", function(){
            $.get("new-data-from-url", function(newData){
                that.setState(newData);

                // to sync manually do
                this.refs.myRef.syncData();
            });
        });

        return {
            myData : [{value:'One',selected:true},{value:'Two'}]
        };
    },
    render: function () {
        return (
            <Multiselect onChange={this.handleChange} ref="myRef" data={this.state.myData} multiple />
        );
    }
});

Documentation

For in depth documentation, see the original bootstrap-multiselect project page.

Links

License

Copyright (c) 2014 skratchdot
Uses the original bootstrap-multiselect license.

About

A multiselect component for react (with bootstrap). This is a react port of bootstrap-multiselect.

Resources

License

Stars

Watchers

Forks

Packages

No packages published