I seem to be running into an issue with my async and await functions not working and I am relatively new to this...
When I call the CallToPopulateCustomerDropDown, I never get to the call for SetCustomerMultiColumnAfterAddingNewCustomerFromNewOrder ( I know this because I have break point here in it and it never gets hit). So I am figuring that I have written something wrong
Here is my code
async function CallToPopulateCustomerDropDown(ddlCustomer, selectedValue) { await CallPopulateCustomerDropDown(ddlCustomer, selectedValue); SetCustomerMultiColumnAfterAddingNewCustomerFromNewOrder(); } function CallPopulateCustomerDropDown(ddlCustomer, selectedValue) { try { return new Promise((resolve, reject) => { LogCallStackToConsole('populateCustomerDropDown(ddlCustomer, selectedValue)'); //#region Variable Declarations let orderField, grid, ds, foundCatalog, dd; //#endregion for (i = 0; i < CustomersList.length; i++) { if (CustomersList[i].Company.length == 0) { CustomersList[i].Company = CustomersList[i].FirstName + " " + CustomersList[i].LastName } } $(ddlCustomer).empty(); $(ddlCustomer).kendoMultiColumnComboBox({ placeholder: "Select Customer...", dataTextField: "Company", dataValueField: "CustomerID", height: 300, columns: [ { field: "FirstName", title: "First", width: 200 }, { field: "LastName", title: "Last", width: 200 }, { field: "Company", title: "Company", width: 200 } ], footerTemplate: "#: instance.dataSource.total() # Customers Found", filter: "contains", filterFields: ["FirstName", "LastName", "Company"], dataSource: { data: CustomersList, sort: [ { field: "FirstName", dir: "asc" }, { field: "LastName", dir: "asc" }, { field: "Company", dir: "asc" } ] }, change: function () { }, select: function (e) { LogCallStackToConsole('populateCustomerDropDown(ddlCustomer, selectedValue).select'); orderField = $('#txtOrderName').val(); grid = $('#gridNewOrder').getKendoGrid(); ds = grid.dataSource.view(); foundCatalog; for (let i = 0; i < ds.length; i++) { if (ds[i].Catalog.length > 0) { foundCatalog = true; break; } } if (orderField.length > 0 && foundCatalog) { $('#btnOK').prop("disabled", false); } } }); if (selectedValue != null) { dd = $(ddlCustomer).data("kendoMultiColumnComboBox"); dd.value(selectedValue); } }); resolve(); } catch (err) { reject(); } } function SetCustomerMultiColumnAfterAddingNewCustomerFromNewOrder() { let customerMultiColumn = $('#ddlCustomer').data("kendoMultiColumnComboBox"); customerMultiColumn.select(function (dataItem) { return dataItem.Company === g_CustomerEditorObject.companyName; }); ResetGlobalObject(g_CustomerEditorObject); }