Adding dashboard to screen programatically


I’ve successfully added the dashboard addon to our application and also created a number of dashboards. I’ve also managed to add a default dash to the ext-mainWindow screen using XML code:

<dashboard:dashboard id=“dashboardId”
<dashboard:parameter name=“role”

Unfortunately having this hard coded causes login problems if the dashboard no longer exists (ie user has deleted or is on a completely new instance with no dashboards setup. I have not been able to find a suggested workaround for this but think it could be resolved by programmatically adding the dashboard to the ext-mainWindow by looking in the appropriate dashboard data tables to see if and what exists for the logged in user.

Is there a way to add the dashboard component to the screen programmatically? I have tried adding the dashboard using the usual componentsfactory.createcomponent but this has not been successful.

Any help would be appreciated as it is a great addon and really want to be able to use it. Obviously if there is a better way to achieve this than I’ve suggested then please feel free to suggest.


1 Like


Please try to use following code to select correct dashboard in your main window:

public class ReferenceDashboardController extends AppMainWindow {

    protected DashboardFrame dashboard;

    public void init(Map<String, Object> params) {

If the application has more than one dashboard, which one will be displayed? Is there any way to set a default dashboard of the user?


You will need to write code in main screen controller which will set correct dashboard code depends on your requirements