question

anon-user avatar image
0 Likes"
anon-user asked Jonah K edited

Replace One dashboard by Another by Button Click and Dock It

Hi FlexSim team,

Let me explain the situation. I have a total of three dashboards in the model. The 1 and 2 are shown in the screenshot. I want to replace the dashboard 1 with a 3rd dashboard by a button click in the 2nd dashboard. In other words, on the button click first dashboard has to collapse and on the same position, the 3rd dashboard has to appear. The 2nd one remains as it is on the right-hand side. One model tab is also there, it has to also remain wherever it is.

Thanks and Regards,

Brijesh Kumar.




FlexSim 23.2.0
dashboards
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

There's something weird going on with this model - when I try to auto open it - it says it's a 23.1 model and it is trying to open in 23.2. I can't open it in 23.1 or 23.2. Have you edited the tree version numbers in some way?

0 Likes 0 ·
anon-user avatar image anon-user commented ·

Hi @Jason Lightfoot ,

PFA.


0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ anon-user commented ·

I can supply the code to close a dashboard:

string dashtoclose="Dashboard3";
treenode dash=first(views().find("active>Documents/Dashboard"));
while (dash&& ownerobject(dash.value).name!=dashtoclose)
    dash=next(dash);
applicationcommand("closedockedtab",ownerobject(dash.value));

but at the moment - opening one in the correct tab pane is eluding me.

0 Likes 0 ·

1 Answer

·
Jonah K avatar image
0 Likes"
Jonah K answered Jonah K edited

This model should get you most of the way by using this code:

treenode DB3 = findmatchintree(views().find("active"), a.name == "Dashboard3");
applicationcommand("closedockedtab", DB3);

applicationcommand("dashboard", Model.find("Tools/Dashboards/Dashboard1"));

This will close Dashboard3 and open Dashboard1 in a pop out window. This a custom code in the Dashboard2 "Open Dashboard 1" button. The inverse is found in the other button.

DashboardOpenCloseJK.fsm


· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

anon-user avatar image anon-user commented ·

Hi Jonah K ,

First of all thank you for your answer, but docking is not happening correctly as I have mentioned in the post.

Could you please look into it?

Attached is the video of docking for reference.


Video.mp4


0 Likes 0 ·
Jonah K avatar image Jonah K ♦ anon-user commented ·

I was able to update the code so it will dock it to the main panel and close the old tab with the application commands "dockwindow" and "closedockedtab" as you can see here:

treenode DB1 = applicationcommand("dashboard", Model.find("Tools/Dashboards/Dashboard1"));
treenode DB3 = findmatchintree(views().find("active"), a.name == "Dashboard3");
if (DB3){
treenode tabPane = DB3.up.up;
treenode newTab = DB1;
if (newTab != tabPane){
applicationcommand("dockwindow", tabPane, newTab, 1);
}
applicationcommand("closedockedtab", DB3);
}
refreshview(c.up.up.up);

Here's the updated model:

DashboardOpenCloseJK2.fsm

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.