0
我正在使用jQuery Typeahead plugin,但如果我尝试设置初始数据,则会发生错误,并且输入的值为false
。错误 - 缺少字符串 - jQuery Typeahead
这里是我的配置:
var typeaheadOptions = {
dynamic: true,
display: ['title'],
template: '<span>{{title}}</span>',
cache: true,
debug: true,
multiselect: {
matchOn: ['id'],
data: [{title: 'title1'}, {title: 'title2'}],
callback: {
onCancel: function(node, item) {removeItem(item)}
}
},
source: {
posts: {
ajax: {
method: 'GET',
url: remoteURL,
data: {search: '{{query}}'}
}
}
},
callback: {
onClick: function(node, a, item) {addItem(item)}
}
};
这里是错误:
ERROR - Missing string": {
arguments: "",
function: "helper.namespace()",
message: "ERROR - Missing string",
node: "#media-kit-post"
}
这是什么样子:
我缺少的东西?
你从'remoteURL'返回的数据格式是什么? –
类似于'multiselect.data'属性。 '[{title:'一些标题'}]' – sydev