How to refresh after delete dashboard from external api

In the dashboard section, For deleting the dashboard through the external API, but I can't refresh the dashboard. but I try with inbuilt delete API that time refresh is working fine. If I want to use the same code for external API's refresh that time If you hit the same dashboard twice then second-time refresh the Dashboard happen. Please suggest to me how I will do first hit only.

You can use the Visualize app to create visualizations that can provide insight to your logs. See Creating a visualization for instructions

No I am asking when i want to delete the custom dashboard instead of inbuilt delete method, I called the External API when I will get the response that time I want refreshes the dashboard..

in built method :

dashboardService.delete(selectedIds)
.then(fetchItems)
.then(() => {
deselectAll();
})
.catch(error => notify.error(error));

External API :

$http({
method : "POST",
url : '/v1/schedule/delete',
data: {type:selectedIds}
}).success(function(resp).then(fetchItems)
.then(() => {
fetchItems(); //refresh the dashboard
deselectAll();
notify.info(resp);
}).catch(error => notify.error(error));
}).error(function(resp){
notify.error("The offline aggregator service is down. ")
});

Here when I am twice hit the external API then after Refresh the dashboard. Please suggest why it's happening?

Sorry for the first reply, posted an answer to a different question into this thread, too many browser tabs open.

Are you executing your success handler in the context of Angular digest cycle? Try wrapping your fetchItems inside of the below logic. Angular will only update the DOM when a digest cycle is run

$scope.$evalAsync(() => {
}

Hi Nathan,

I totally removed the inbuilt delete api , i used the external delete api what code already shared . here issue, it's not refresh first time, when twice i hited the delete api then refresh is happening. Please suggest to me what i missed here.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.