2015-10-07 31 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

謝謝你對我的工作.. –