Git Product home page Git Product logo

multiselectorder's Introduction

multiSelectOrder

Work in progress

jQuery plugin for a simple two panels multi select with order

demo

Features

  • Bootstrap friendly
  • Add new elements to the options
  • Restrict the addition of new elements by using JavascriptRegExp

TO-DO

  • Options to use own CSS classes

Usage

Use it like a regular select, then call $.("#target").multiSelectOrder().

For preselected values, the plugin ignores the "selected" atribute in options. You must use the attribute data-multiSelectOrder-values to pass a list of the values of the selected options. This should be done in order to ignore the order of the options list, while keeping the order of the values For example, the options must be in alphabetical order, but the selected values are not in order.

Submit and you will receive a ordered list of the selected items

Limitation: the select tag must contains the multiple atribute for a correct behaviour

<select id="target" name="patata" multiple data-multiSelectOrder-values="26,25,24">
    <option value="21">One</option>
    <option value="22">Two</option>
    <option value="23">Three</option>
    <option value="24">Four</option>
    <option value="25">Five</option>
    <option value="26">Six</option>
    <option value="27">Seven</option>
</select>

<script>
    $("#target").multiSelectOrder({extra: false, extraPattern: ''})
</script>

Options

noOrder (Boolean): If true, the ordering buttons will not be displayed

default: false

bootstrap (Boolean): If true, bootstrap css classes will be applied. You must include bootstrap by yourself

default: false

extra (Boolean): Include the input for adding new items

default: true

extraOptions (String[]): List of extra options

default: []

extraPattern (String): If defined, the added options will be filtered with a RegExp(extraPattern, 'i')

default: false

extraButton (String): Text or html to be shown in the include button for extra options

default: +

extraPlaceholder (String): Text to be shown in the input of extra options as placeholder

default: ''

i18n: (Json): translations. If used you must supply all the translations

* selectAll: *selectAll*

* selectNone: *selectNone*

* first: *already first*

* last: *already last*

* already: *already exists*

* invalid: *is not valid*

multiselectorder's People

Contributors

racoonman avatar mbanon avatar

Stargazers

Jonathan Barratt avatar

Watchers

 avatar

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.