diff --git a/portal/static/js/src/admin.js b/portal/static/js/src/admin.js index 391a5f218..718b1d8a4 100644 --- a/portal/static/js/src/admin.js +++ b/portal/static/js/src/admin.js @@ -143,6 +143,12 @@ let requestTimerId = 0; errorElement.innerHTML = errorMessage; } }, + clearError: function() { + var errorElement = document.getElementById("admin-table-error-message"); + if (errorElement) { + errorElement.innerHTML = ""; + } + }, injectDependencies: function () { var self = this; window.portalModules = @@ -200,6 +206,8 @@ let requestTimerId = 0; ); return; } + //reset error + this.clearError(); this.patientDataAjaxRequest(params); }, patientDataAjaxRequest: function (params) { @@ -219,6 +227,12 @@ let requestTimerId = 0; } self.accessed = true; params.success(results); + }).fail(function(xhr, status) { + console.log("Error ", xhr); + console.log("status", status); + self.setError("Error occurred loading data."); + params.success([]); + self.accessed = true; }); }, handleCurrentUser: function () { @@ -1229,11 +1243,12 @@ let requestTimerId = 0; sync: true, }, function (data) { + prefData = data || self.getDefaultTablePreference(); + self.currentTablePreference = prefData; + if (!data || data.error) { return false; } - prefData = data || self.getDefaultTablePreference(); - self.currentTablePreference = prefData; if (setFilter) { //set filter values @@ -1303,6 +1318,7 @@ let requestTimerId = 0; for (var item in prefData.filters) { fname = "#adminTable .bootstrap-table-filter-control-" + item; if ($(fname).length === 0) { + prefData.filters[item] = null; continue; } //note this is based on the trigger event for filtering specify in the plugin diff --git a/portal/templates/admin/patients_by_org.html b/portal/templates/admin/patients_by_org.html index 6c0514d51..2465f98f5 100644 --- a/portal/templates/admin/patients_by_org.html +++ b/portal/templates/admin/patients_by_org.html @@ -65,7 +65,8 @@