Coder Social home page Coder Social logo

nyon / jquery-multiselect Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yanickrochon/jquery.uix.multiselect

0.0 2.0 0.0 610 KB

Completely rewritten, multiselect widget with a more concise API

Home Page: http://mind2soft.com/labs/jquery/multiselect/

License: MIT License

CSS 3.72% HTML 34.83% JavaScript 61.45%

jquery-multiselect's Introduction

jQuery UIx Multiselect

Version 2.0

Preview

Introduction

This widget is a complete rewrite of the previous version. Why a new rewrite? Because the original widget's attempt was to create a all-in-one-out-of-the-box-multi-featured SELECT replacement and thus failed to be compliant with the DOMElement's behavior and limitations. Notably, it failed to :

  • update the option items when modifying the SELECT element directly
  • didn't support disabled items
  • didn't support item groups
  • etc.

Also, it quickly became slow when loading a few hundred items and some branches had drag and drop issues.

Release notes

This widget is stable enough to be used in staging environments. However it is still under development, in testing phase, as some features may require more feedbacks yet! (Mainly browser compatiblity.) At this point, expect minor bug fixes within 72 hours, and there will be no more features planned at this point.

The compressed (minified) version is created using the YUI Compressor.

Requirements

  • jQuery 1.8+
  • jQuery UI 1.9+

Features

  • Support for disabled options
  • Support for option groups
  • Option group collapsable
  • Draggable drop and/or sortable enabled
  • Mouse selection mode (click, dblclick)
  • Support for predefined or custom sort functions
  • Searchable
  • List layout and select direction (horizontal or vertical)
  • Custom item renderer

Usage

Note : Even though it is a complete rewrite of the widget, I kept the multiselect widget name (but it is declared as uix.multiselect instead of ui.multiselect).

$('selector').multiselect();

To programmatically select/deselect, add/modify/remove items, you may access and modify the DOMElement directly, then call the refresh widget method to update it.

$('selector').append("<option value='item1'>My Item 1</option>")
             .multiselect('refresh');

// manually filter available options
//   This will only render visible the available items containing 'My Item' (case insensitive)
$('selector').multiselect('search', 'my item');

$('selector').multiselect('destroy');  // restore original element

See wiki documentation for more information.

TODO

  • add custom item rendering support (needs more tests)
  • HTML5 ARIA attributes
  • Make all options as mutable as possible after initialization.
  • Test in all major browsers (not fully tested)
  • Mobile support
  • Code cleanup
  • etc.

Limitations

  • When setting sortable option to true, options can only be reordered within their own groups. That is, an option cannot be reordered between two options of a different group. As this widget's purpose is not to extend the original element's behaviour beyound user interaction and presentation, this limitation shall not be lifted for the time being.
  • This widget was designed for modern browsers usage. It is working fine in IE7+, Firefox and Chrome. Note that it will not work in quirks mode. There will be little to no support for non standards compliant browsers.

jquery-multiselect's People

Contributors

demonslord avatar dv-petrov avatar janbolmeson avatar karmux avatar kennethtruong avatar ksiegel avatar mauriciopasquier avatar yanickrochon avatar

Watchers

 avatar  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.