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