Purus Purus - 6 months ago 17
Javascript Question

Typeahead.js remote call restriction

I am using Twitter's Typeahead.js with around 15 remote calls. In the example below, part of my code is given with the names "list1" and "list2". My actual codes goes till list15 from list1.

{
name: "list1",
remote: "/get-list1/%QUERY",
template: "<p><strong>{{value}}</strong> - {{extract}}</p>",
engine: Hogan,
maxParallelRequests : 15
},
{
name: "list2",
remote: "/get-list2/%QUERY",
template: "<p><strong>{{value}}</strong></p>",
engine: Hogan,
maxParallelRequests : 15
},


The code works without any issues. But only remote calls are made only for the first 6 datums and the rest are ignored. When I did some reading, I came to know that there is a default limit of maximum number of remote calls (maxParallelRequests).

maxParallelRequests – The max number of parallel requests typeahead.js can
have pending. Defaults to 6.


As seen in the above code, I have set the maxParallelRequests value to 15, but still it executes only 6 remote calls.

Is my method of providing the setting wrong? Please correct me what I am missing.

Answer

I believe you need to be specifying maxParallelRequests in a remote object, at least according to the docs.

{
                name: "list1",
                remote: {
                   url: "/get-list1/%QUERY",
                   maxParallelRequests: 15
                },
                template: "<p><strong>{{value}}</strong> - {{extract}}</p>",
                engine: Hogan
}
Comments