While working with knockout Java-script, I encountered a perplexing issue. I have an API call to a controller which has several methods that are functioning correctly. However, when I set a break point on a specific method, it never gets hit. Strangely, data is being returned from this method in the controller as confirmed by my debugging in the Java-script. Can anyone offer insights into what might be causing this puzzling behavior?
Here is the snippet of my knockout code:
function FetchDeviceRows(dtvm, item) {
$.when(getSecureData("/api/DeviceHierarchy?parentCostCentreId=" + item.assetInstanceId() + "&noChildren=" + item.noChildren() + "&orgLevel=" + item.orgLevel()))
.done(function (rows) {
InsertActualDeviceRows(dtvm, item, rows);
RefreshWholeDevicePage(dtvm);
});
}
Below is the DeviceHierarchy Controller method being accessed by my knockout. Despite setting a break point here and not hitting it, debugging at .done(function (rows) in my knockout reveals that data has been returned:
[HttpGet]
public IEnumerable<DeviceHierarchyRow> Get(int parentAssetInstanceId, int noChildren, int orgLevel)
{
var hierarchies = _deviceHierarchyRepository.GetDevices(parentAssetInstanceId, noChildren);
return hierarchies.ToList().Select(h => new DeviceHierarchyRow(orgLevel + 1, 0, 0, "", "", h.noChildren, _pageSize, false));
}