How can I change the selected text when using Multiple Select jQuery plugin

10.6k views Asked by At

I am using this cool Multiple Select plugin

Please look at "The Position" options. I would need to display either 1 text or 5 of 12 selected.

so If I only select 1 option then display that option if I select more than 1 then just state 2 of 12 are selected.

It seems that the default here is set to 4 and I need to override this.

How can I change the default value?

Here is my code

$(function(){                                           
   $(".multipleSelectMenuMask").multiselect({
   enableFiltering: true,
   enableCaseInsensitiveFiltering: true,
   selectedClass: null,
   nonSelectedText: "Select an option",
   includeSelectAllOption: true,
   buttonWidth: "100%",
   maxHeight: 250
   });
});
4

There are 4 answers

0
Jaylen On BEST ANSWER

I figured out the problem.

I am using bootstrap-multiselect not Multiple Select plugin

the option is

numberDisplayed
0
Apache On

Bower get not last version of plugin. Check your sources:

Line 245: } else if (selects.length > this.options.minumimCountSelected && this.options.countSelected) {

and

Line 443: minumimCountSelected: 3,

minUmIm

Now you can change option name to minumimCountSelected and temporary fix it in version 1.1.0.

3
Ragnar On

Take a look at constructor http://wenzhixin.net.cn/p/multiple-select/docs/#constructor

minimumCountSelected

Type: int

countSelected will be shown only if more than X items where selected.

By default this option is set to 3.

0
Alexandru Sirbu On

use Bootstrap multiselect here

$(".example-class-multiselect").multiselect({
    nonSelectedText: "Select an option",
    allSelectedText: "Selected all",
    nSelectedText  : "Selected",
    //...
});