Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi,
TW version 9.1
I want to add a button to a mashup that will close the mashup on click
The expression=close() does not seem to work anymore or can anyone mention how to use it correctly.
Thanks in advance.
Hello @SB_9732186
Please refer following docs to solve your query:
https://community.ptc.com/t5/ThingWorx-Developers/Close-popup/m-p/652897
Let me know if it doesn't resolve your problem
Thanks
Om Dukiya
Hi @odukiya
I think you have provided answer for popup. In subject line already written not popup its mashup or tab that he is trying to close.
Thanks
Hi @odukiya,
Like I have mentioned previously that the expression=close() is not working anymore, or I don't know how to implement it correctly.
If you can provide the actual expression that I should put in the expression function, that would be helpful.
And also its not a popup like @VS_9760165 mentioned.
I have attached few screenshots.
Thanks in advance.
The close() function you tried to use is not executed in the context of your visible DOM window, but instead it is sandboxed by the Expression function for security reasons.
Due to this, the close() does not take effect on the window you presume it will.
I am not aware of a way to achieve exactly what you want - but perhaps you should explain to the community in more detail why you need to mashup to be closed - you are aware that you will remain logged in, right?
Perhaps the Logout function is a better candidate?
Be aware that in your question you asked about closing a Mashup, and Mashups in ThingWorx can be embedded as popups in other Mashups, hence the previous answer.
Hi @VladimirRosu,
Thanks for your input, it certainly made me understand why the close() was not working as I intended it to.
As per your question on why do I need to close a mashup without logging out, I want to open a mashup as a popup when a hyperlink which is embedded within a cell in the grid advanced widget is clicked. Since I can not open a popup on a click of hyperlink in a grid, I thought of opening a mashup itself & then adding a button to it to close it, thus making it functionally identical to a popup.
If anyone can tell me how to open a popup style mashup on a click of a hyperlink in a grid advanced widget (each row has multiple unique hyperlinks), that would be really helpful.
Thanks in advance.
Ah, get it.
This is one of the fine lines when you need to decide if the Grid fits your purpose or you need to use the Collection.
Frankly said I did not spend too much time with the Grid to see if that's doable, but exactly at this moment in time I would decide that the flexibility given by the Collection is needed, so I would switch to it.
Not sure if you used Collection before, but basically it repeats a Mashup you design as the row, based on the number of rows you give it as an input. It is in this "row" mashup where you can add your own button which triggers a Navigation function and make it open a popup...etc
Hi @VladimirRosu,
I don't think Collection widget is the right thing to use in this case, as my grid consists of 100+ rows, so if a collection is used then it will amount to 100+ mashup loads which will be a huge load on the server.
I am not actually sure, let me see how the collection widget actually works & get back to you.
Thanks in advance.
You will actually see that this is one of the biggest advantages of the collection: regardless of the number of rows you give it, it renders (and calls appropriate services, if bound to load at Mashup load) only for the visible rows of the collection
Hi @SB_9732186.
If the one of the previous responses answered your question, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon