我正在使用安装了 x-editable-bootstrap Meteorite(和 bootstrap)包的 Meteor。
当我将 select2 标签设置为可编辑时,加载指示器一直旋转,无法输入标签。试了很多,希望有人能帮忙!
在我的模板中有一个
<div id="editableStuff" data-title="Blah enter tags plz">Apple, Banana</div>
在我的 Template.rendered 中,我有一个 jQuery on-dom-ready 函数 à la
$(function(){
$('#editableStuff:not(.editable-click)').editable('destroy').editable({
success: function(response, newValue) {
Session.set('tmp'+name,newValue);
},
placement:'left',
select2: {
tags: ['cake', 'cookies'],
tokenSeparators: [",", " "]
},
type:'select2'
});
};
用虚线在页面上创建默认元素。单击该元素会出现 x-editable 弹出窗口,但它不会加载输入字段,加载指示器只会一直旋转。
控制台记录以下错误:
TypeError: 'undefined' 不是一个函数(评估 'this.$input.select2(this.options.select2)')
在 x-editable-bootstrap.js:3683
我发现当我删除 editable({..})
中的 type:'select2'
时,文本字段已加载,但没有标签-功能。
有什么想法吗?非常感谢任何提示!其他 x-editable 类型,如 address
和 text
使用上面的代码模式就像一个魅力!
最佳答案
我没有在 meteor 上试过,但在 Rails 上遇到了同样的问题。事实证明 x-editable-bootstrap 不会自动随 select2.js 一起提供。确保您还加载了 select2.js
关于javascript - x-editable-bootstrap select2 标签 - 加载指示器永远旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18534717/