I have a common auto complete control that I use on two different pages. The AutoComplete control is populated with the same data set as a Kendo Grid on the page. Both pages have filters by which users can filter the data in the Kendo Grid (using built in Kendo Filter functionality). We don't want superfluous results to show up in the AutoComplete therefore we reset the AutoComplete dataset to match the newly filtered dataset of the Kendo Grid. To accomplish this we use the .setDataSource method of the AutoComplete control (see code below). The AutoComplete control works well within page A after the new data source is set. However, the AutoComplete does not work within Page B. When a user types in criteria into the AutoComplete in Page B the popup never shows, not even to say "NO DATA FOUND". No error is shown within the Browser Developer tools either. When I interrogate the control I see that the data set is in fact applied correctly. I see the correct number of items. In fact after typing in some value to the AutoComplete control on Page B when I interrogate the dataSource I see that the view property of the dataSource is populated with the correct filtered items (i.e. if I type in "asse" into the AutoComplete then I see only two items in the view with "Asset" in their name). However, the pop up still doesn't show up. When I interrogate the popup I see nothing in its view. It seems like the pop up is just lying dead in the water for Page B. I have tried many things to figure out why. Does anyone have a suggestion for something to look into?
//prepare Kendo Filters for Kendo Grid
var siteFilters = buildSiteMenuFilters(result.data);
//apply Kendo Filters to Kendo Grid
menuGridDataSource = $("#MenuGrid").data("kendoGrid").dataSource;
menuGridDataSource.filter(siteFilters);
//get filtered dataset from Kendo Grid
var allData = menuGridDataSource.data();
var query = new kendo.data.Query(allData);
//create variable to store filtered results
saveMenu = [];
//convert filtered dataset from Kendo Grid into an array of objects that match the AutoComplete control Instantiation
filteredList = query.filter(siteFilters).data;
filteredListLength = filteredList.length;
for (var i = 0; i < filteredListLength; i++) {
saveMenu.push({ Id: filteredList[i].Id, Name: filteredList[i].Name, LongName: filteredList [i].LongName, uid: filteredList[i].LongName })
}
//set the AutoComplete control data source to match the new filtered list
var menuSearchAutoComplete = $("#menuSearch").data("kendoAutoComplete");
menuSearchAutoComplete.setDataSource(removeHtmlTags(saveMenu));