js bloodhound与建议引擎限制不工作只显示6条记录



我想显示所有列表数据提前输入,但使用以下代码,其显示只有6条记录的焦点在提前输入文本框

var subproduct = new Bloodhound({
        datumTokenizer: function (d) {
            return Bloodhound.tokenizers.whitespace(d.Text);
        },
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        local: SubProductList
});
function subproducttypehead(q, sync) {
    if (q === '') {
        sync(subproduct.all()); // This is the only change needed to get 'ALL' items as the defaults
    } else {
        subproduct.search(q, sync);
    }
}
var typeaheadsub = $('#subproduct');
typeaheadsub
.typeahead({
    minLength: 0,
    highlight: true
},
{ 
    displayKey: 'Text',
    source: subproducttypehead
});

    var subSelectedHandler = function (eventObject, suggestionObject, suggestionDataset) {
        $("#subproduct_id")[0].value=suggestionObject.Value;
    };
    typeaheadsub.on('typeahead:selected', subSelectedHandler);
}

如何在预输入或自动完成

中显示SubProductList1中的所有项目

我想这可能对你有帮助…限制问题解决- jsfiddle(点击)

{
source: subproducttypehead,
limit:9999,
templates: {
empty: [
   '<div class="empty-message">',
   'No match found',
   '</div>'
].join('n'),
 suggestion: function(query, context){
        return '<div>'+ query.name +'</div><br/>';
 }

最新更新