bootstrap 多选下拉菜单没有下拉
bootstrap multiselect drop down is not dropping down
我正在使用 bootstrap multiselect plugin and binding the data to it with knockout js. It is in this jsfiddle。这些选项实际上确实将数据绑定到多选 - 您可以通过右键单击 jsfiddle 输出中的多选元素 window 并检查它来确认这一点,<option>
确实存在。但是,单击多选元素不会导致下拉列表下拉。
bootstrap multiselect does not seem to know that it has <option>
's in the <select>
, this is proven when I use the disableIfEmpty 配置选项,永久禁用多选。为什么 bootstrap 多选不知道它有选项,从而导致它无法打开下拉菜单?
您只能实例化您的多选小部件在 knockout 完成渲染后,这基本上是在 您的应用绑定之后。
要了解这个想法,请查看这个分支 fiddle:http://jsfiddle.net/r0kbch7u/
我基本上已经将 $("#category-select").multiselect()
代码从您的 CategorySelect
构造函数移至您的文档加载事件侦听器。
我正在使用 bootstrap multiselect plugin and binding the data to it with knockout js. It is in this jsfiddle。这些选项实际上确实将数据绑定到多选 - 您可以通过右键单击 jsfiddle 输出中的多选元素 window 并检查它来确认这一点,<option>
确实存在。但是,单击多选元素不会导致下拉列表下拉。
bootstrap multiselect does not seem to know that it has <option>
's in the <select>
, this is proven when I use the disableIfEmpty 配置选项,永久禁用多选。为什么 bootstrap 多选不知道它有选项,从而导致它无法打开下拉菜单?
您只能实例化您的多选小部件在 knockout 完成渲染后,这基本上是在 您的应用绑定之后。
要了解这个想法,请查看这个分支 fiddle:http://jsfiddle.net/r0kbch7u/
我基本上已经将 $("#category-select").multiselect()
代码从您的 CategorySelect
构造函数移至您的文档加载事件侦听器。