Close Application Tabs Programmatically

With the setting “[SIZE=12px]Open items in a tab” one can since version 8 from a menu application open each selected menu item (i.e. application item) in a new tab. This is just great as one can easily open and work with several part of the full application.[/SIZE]

[SIZE=12px]Sometimes, however, an application tab is only needed for a specific task/process, e.g. may be prompted for some information in a control form application and based on this, the task is performed. Afterwards the application tab is not relevant anymore. In this case it would be good if it could be closed programmatically, rather than the user having to manually close it. Is this possible?[/SIZE]

you can close it by using the SC_EXIT macro.

Have you tried it?.

Regards

Unfortunately, I cannot get the SC_EXIT macro to work properly. The problem is that it returns to the previous application which is the menu, but it opens a new instance of it. Thus, there is the original menu in the left side (as I use a vertical menu application) and then a new instance of the same menu in the tab that was already opened. SC_EXIT does not exit the tab.

Perhaps that behaviour could be considered a bug. What do you think?

If you can use JS, you can try triggering the same JS function that SC attach to the ‘x’ icon for closing tabs.

Move your mouse over the ‘x’ inside the tab to see the name and parameter of the JS function to use

I just tried in the browser JS console and executing


[SIZE=12px]del_aba_td('item_25'); [/SIZE]

did close my tab.

Okay, I must admin that I am somewhat of a novice in JS when used to handling web pages.
When I move my mouse over the ‘x’ icon on the tab, I just a get tool tip containing the name of the tab itself. How do you get the JS function name to show?

I have reported the behaviour of SC_EXIT to ScriptCase. It is kind of gross and must be considered a bug.

Depends on the browser.
With Chrome I get the URLs or onclick JS functions displayed on the bottom left of the chrome window when the mouse is over a link.
If that’s not sohwn, right click on the ‘x’ icon and select ‘Inspect’ to see the page code.

[TABLE=“class: nmTable form_tab_id_blk_lnk_opn_desktop_navigate, cellpadding: 0, cellspacing: 0, width: 1286”]
[TR]
[TD=“class: nmLineV3”]Tab context menu[/TD]
[TD=“class: nmLineV3”] [/TD]
[TD=“class: nmLineV3”]Yes No[/TD]
[TD=“class: nmLineV3”] [/TD]
[TD=“class: nmLineDesc”]Creates a context menu to manage the menu tabs[/TD]
[/TR]
[TR=“class: nmTableLine”]
[TD=“colspan: 5”][/TD]
[/TR]
[TR]
[TD=“class: nmLineV3”]Menu tabs navigation[/TD]
[TD=“class: nmLineV3”] [/TD]
[TD=“class: nmLineV3”]Yes No[/TD]
[TD=“class: nmLineV3”] [/TD]
[TD=“class: nmLineDesc”]Activates the tab navigation when many tabs are opened at the same time.[/TD]
[/TR]
[/TABLE]

If I turn any these options turned on, I cannot see the JS functions under the developer tools.

However, better yet: ScriptCase has come back and acknowledged that the problem with SC_EXIT that I described above is a bug so it will be fixed.

Because the application runs in an iframe, you may need to prefix with parent., so
[SIZE=12px]del_aba_td(‘item_25’); [/SIZE] becomes [SIZE=12px]parent.del_aba_td(‘item_25’); [/SIZE]

1 Like

Ah, good to know.

[SIZE=12px]parent.del_aba_td('item_25');

Yep.
I just tested it and it works in a scriptcase JS button on a form.
With PHP it should work with [/SIZE]sc_ajax_javascript();

1 Like

I consider it to be bug, actually it is a BUG. setting up close window should not go to menu again but it should close the tab.
SC is full of inconsistencies and the end result so far cost too long to deal with all kind of issues. SC, you should really make serious steps and improve UI logics.
closing tabs is one of examples , i have a whole list of shit like this.

Although this post has been around for nearly a year, see that as I mention in my workaround for another problem I saw, sc_exit works differently in development and production enviroments…
it goes to the menu in DEV, but correctly exits tabs and apps in PROD (at least in my test case).

If it wasnt for the fact that I tried the app in production enviroment, I would have thought that my button was not working as expected.