From 7bdad568373f6aa0b7444d2988ac8492ae37721a Mon Sep 17 00:00:00 2001 From: _pants <_pants@anotherwebsite.org> Date: Sat, 12 Jan 2013 11:37:57 -0500 Subject: [PATCH] allow passing a function for maximumSelectionSize --- select2.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/select2.js b/select2.js index 13bbd12b..8e89c011 100644 --- a/select2.js +++ b/select2.js @@ -1235,10 +1235,11 @@ the specific language governing permissions and limitations under the Apache Lic postRender(); } - if (opts.maximumSelectionSize >=1) { + var maxSelSize = $.isFunction(opts.maximumSelectionSize) ? opts.maximumSelectionSize() : opts.maximumSelectionSize; + if (maxSelSize >=1) { data = this.data(); - if ($.isArray(data) && data.length >= opts.maximumSelectionSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) { - render("