|
225 | 225 | this.labels = menu.find('label');
|
226 | 226 | this.inputs = this.labels.children('input');
|
227 | 227 |
|
228 |
| - // set widths |
229 | 228 | this._setButtonWidth();
|
230 |
| - this._setMenuWidth(); |
231 | 229 |
|
232 | 230 | // remember default value
|
233 | 231 | this.button[0].defaultValue = this.update();
|
|
517 | 515 | m.outerWidth(this.options.menuWidth || width);
|
518 | 516 | },
|
519 | 517 |
|
| 518 | + _setMenuHeight: function() { |
| 519 | + var headerHeight = this.menu.children(".ui-multiselect-header:visible").outerHeight(true); |
| 520 | + var ulHeight = 0; |
| 521 | + this.menu.find(".ui-multiselect-checkboxes li").each(function(idx, li) { |
| 522 | + ulHeight += $(li).outerHeight(true); |
| 523 | + }); |
| 524 | + if(ulHeight > this.options.height) { |
| 525 | + this.menu.children("ui-multiselect-checkboxes").css("overflow", "auto"); |
| 526 | + ulHeight = this.options.height; |
| 527 | + } else { |
| 528 | + this.menu.children("ui-multiselect-checkboxes").css("overflow", "hidden"); |
| 529 | + } |
| 530 | + |
| 531 | + this.menu.children("ui-multiselect-checkboxes").height(ulHeight); |
| 532 | + this.menu.height(ulHeight + headerHeight); |
| 533 | + }, |
| 534 | + |
| 535 | + _resizeMenu: function() { |
| 536 | + this._setMenuWidth(); |
| 537 | + this._setMenuHeight(); |
| 538 | + }, |
| 539 | + |
520 | 540 | // move up or down within the menu
|
521 | 541 | _traverse: function(which, start) {
|
522 | 542 | var $start = $(start);
|
|
653 | 673 | // show the menu, maybe with a speed/effect combo
|
654 | 674 | $.fn.show.apply(menu, args);
|
655 | 675 |
|
| 676 | + this._resizeMenu(); |
656 | 677 | // positon
|
657 | 678 | this.position();
|
658 | 679 |
|
|
787 | 808 | menu.find('a.ui-multiselect-none span').eq(-1).text(value);
|
788 | 809 | break;
|
789 | 810 | case 'height':
|
790 |
| - menu.find('ul').last().height(parseInt(value, 10)); |
| 811 | + this.options[key] = value; |
| 812 | + this._setMenuHeight(); |
791 | 813 | break;
|
792 | 814 | case 'minWidth':
|
793 | 815 | case 'menuWidth':
|
|
0 commit comments