Customizing the page close behavior for Workspaces

A valued customer asks:

This technique is similar to the thread: “Disabling drop event on a Column in 3 Column Layout” (http://tech.forums.softwareag.com/viewtopic.php?t=24596&sid=287b7b61b4fc7d95cd976f0f93352285) in that both solutions involve placing a custom portlet in the (Noodle) shell footer and replace Out-of-the-box Noodle javscript function with a custom function.

Here’s the code:


var _closeUserTabService;

OpenAjax.hub.subscribe("Noodle.page.load", function(name, page) {
	if (!_closeUserTabService) {
		console.log("Replacing Noodle.tab.closeUserTab");
		_closeUserTabService = Noodle.tabBarContainer.o_tabBar.closeUserTabService;
		Noodle.tabBarContainer.o_tabBar.closeUserTabService = function(modelId) {
			//TODO perform custom logic
			alert("implement custom logic here");
			
			//optionally invoke the default behavior to present the confirmation dialog
			_closeUserTabService(modelId);
		};
	}
});

Regards,
–mark
PageUnloadApp.zip (11.8 KB)

1 Like

Hi Mark,

 I have a scenario where, the user needs to autosave the changes in the page, when he switches to the other tab.  I have implemented the same approach using selectTabService ..instead of the closeTabService. But that doesn't work . Just switching the tab, I get a Confirmation dialog that my changes are not saved.. and I lose the changes when I press Ok.
   var _selectUserTabService;  
      
    OpenAjax.hub.subscribe("Noodle.page.load", function(name, page) {  
        if (!_selectUserTabService) {  
            console.log("Replacing Noodle.tab.selectUserTab");  
            _selectUserTabService = Noodle.tabBarContainer.o_tabBar.selectUserTabService;  
            Noodle.tabBarContainer.o_tabBar.closeUserTabService = function(modelId) {  
                //TODO perform custom logic  
               /// alert("implement custom logic here");  
                 page.save();
                  
                //optionally invoke the default behavior to present the confirmation dialog  
                _selectUserTabService(modelId);  
            };  
        }  
    });  

But this doesn’t work for me… Please clarify.

Thanks,
Chandra.