https://github.com/mydea/handsontable-chosen-editorcss
handsontable-chosen-editor是handsontable column的擴展,實現了在handsontable編輯列中下拉列表,同時支持的多選。jquery
使用後發現,屏幕底部的行中,下拉項沒法顯示,由於下拉項定義的是向下展開,即便下拉項的位置超出了屏幕底部。git
修改方法:github
chosen.css中添加ide
.chosen-container.chosen-with-drop-top .chosen-drop {
left: 0;
top:-220px;
}函數
chosen.jquery.js中的results_show中this
把原來的spa
this.container.addClass("chosen-with-drop");blog
改成rem
var totalheight = $(window).height();
var thistop = $($.find('div.handsontableInputHolder')[0]).offset().top;
if ((parseInt(totalheight) - parseInt(thistop)) < 200)
{
this.container.addClass("chosen-with-drop-top");
}
else
{
this.container.addClass("chosen-with-drop");
}
在results_hide函數中添加
this.container.removeClass("chosen-with-drop-top");
這樣,當底部空間不足時,下拉列表將向上展開。