I have a piece of code that fetches information from the back-end when my page loads
//Bloodhound - Fetches all Project numbers for the current user
var prsysList = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: "../Helper/LookUpProjectNumber/",
cache: false
}
});
//Typeahead on project numbers
$('.typeahead').typeahead({
hint: true,
highlight: true,
minLength: 1
},
{
name: 'prsys',
source: prsysList
});
Now when the user selects a value, I want to based on his previous selection restrict his future choices. To do so, I have another bloodhound that returns me an update list of information
//Bloodhound - Fetches all Project numbers for the current user
var newPrsysList = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: '../Helper/GetCommonPrsys?prsys=' + encodeURIComponent($selectedPrsys),
cache: false
}
});
//Init the new variable
newPrsysList.initialize();
//Rebind all Typeaheads on project numbers
$('.typeahead').typeahead({
hint: true,
higlight: true,
minlength: 1
},
{
name: 'prsys',
source: newPrsysList
});
My problem is that despite the fact that my second bloodhound has an updated version of the data available for the user to select, the list isn't being updated.
Am I doing something wrong here?
Best