2015-10-07 24 views
0

我要显示所有列表数据预输入,但使用下面的代码其显示只有6焦点记录预输入文本框typeahead.js猎犬与建议引擎限制不工作只显示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预输入或自动完成

回答

0

我想这可能会帮助你的所有项目...... Limit problem solved - jsfiddle (click)

{ 
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/>'; 
} 
+0

谢谢你对我的工作.. –