NMultiSelect v. 1.5.2

UPDATE

I know this is a very popular version, but I have made an update for it. It has more features and is much more stable.

You can always find the latest NMultiSelect version here:

http://ndesoft.dk/category/web/js/nmultiselect-js/

OK,

I know, I’m just throwing new versions out, but what else to do? When you guys ask me for a new feature, shouldn’t I just make it?

Well, this version is a minor update, with a new feature requested from bas, (http://ndesoft.dk/2011/04/26/nmultiselect-v-1-5-1/#comment-280):

Selection limits

What it is, is just a new option to add to the instantation object.

It looks like this:

settings = {
                Name: <span class="str">"NMultiSelect_"</span> + $.NMultiSelect.Instances,
                Move: <span class="kwrd">true</span>,
                FilterText: <span class="str">"filter"</span>,
                AvailableText: <span class="str">"Available items:"</span>,
                SelectedText: <span class="str">"Selected items:"</span>,
                Height: 150,
                Width: 150,
                FadeSpeed: <span class="str">"fast"</span>,
                TitleTag: <span class="str">"h2"</span>,
                Title: <span class="kwrd">null</span>,
                SelectionLimit: -1 <span class="rem">// -1 unlimited selections.</span>
            },

It can be any integral value from –1 to, well infinity (and beyond 🙂 ).

When set to –1, the user can select an infinite amount of items, when 0 the user can’t select anything, when 10, the user can select 10 items and so on.

Now you are wondering, why 1.5.2, instead of 1.5.1.1 (or whatever)? Well I have made a few optimizations to the code, moved some things around a bit and changed som names and so on, so it’s 1.5.2.

Download and live examples

A live example of the 1.5.2 release of the NMultiSelect, can be found here.

You can download the NMultiSelect 1.5.2 release here.

  • in: this.RemoveSelection and this.RemoveAll, _clearSelectedInto() does not exist.

    • Hi wilco,

      Sorry for making you have to wait. You are of course right, there’s a problem with a missing method. I will fix this asap, and post the fix here, when it’s complete.

  • Jimmy Blanchard

    Does this project have a github page or anything? I made some changes I’d like to contribute (ability to disable filters and the add/remove all buttons).

    • Hi Jimmy,

      Glad to hear that people actually wants to contribute to this small endevour of mine.

      I have set up a github repository here:
      https://github.com/JohnDoe3000/NMultiSelect

      But how it actually works, I don’t know at the moment, but I think it will come to me after some time.

      Please let me know if you have any problems.

  • richard

    Hi,
    Nice plugin. One comment there is a bug in the filter function if use selection limit. It filter only works over the filter value. That is because the fulter function works over the list returned by _getAll which is limited by selectionlimit.

    The work around I used was to create the new function
    _getAllNoLimit = function(onlyVisible) {
    var tmp = from.find(‘a’);
    if (onlyVisible === true) {
    tmp = from.find(“a:visible”);
    }
    return tmp.slice(0, Infinity);
    },

    and modify the function _filterFrom_keyUp to replce the line

    var all = _getAll(),
    WITH
    var all = _getAllNoLimit(),

    • Hi Richard,

      Thanks for the info. Hi have checked it out and your fix will be available in the next version.