cancel
Showing results for 
Search instead for 
Did you mean: 

Remove WorksetItem of Shell and make it visible again

Former Member
0 Kudos

Hello,

we use the SAPUI5 element 'shell'. After selecting a few things on the first tabs we create a new tab "results" and present the aggregation of the previous selection the user has made.

Now the user can go back to the first tab in order to start a new selection. Therefore we remove the "result" tab using this method:

     oShell.removeWorksetItem("RESULT");

If the user makes a new selection and we want to add the result tab again we get an error that says:

     Uncaught Error: Error: adding element with duplicate id 'RESULT'


We also tried to remove the WorksetItem using this method:

    

oShell.destroyWorksetItems("RESULT");


but it didnt't work, either.


My question would be. Is it possible to 'really' remove the WorksetItem or is it possible to hide it until another selection has been made?


Thanks in advance for your help.


Regards,

Stefan

Accepted Solutions (1)

Accepted Solutions (1)

former_member182650
Contributor
0 Kudos

Hi Stefan,

Try destroying worksetitem after removing from shell. After that, this worksetitem ID is not used and you could instantiate a new one with the same id.

This is the example:


var workset = sap.ui.getCore().byId("your_worksetitem_id");

sap.ui.getCore().byId("your_shell_id").removeWorksetItem(workset);

workset.destroy();

sap.ui.getCore().byId("your_shell_id").insertWorksetItem(new sap.ui.ux3.NavigationItem("your_worksetitem_id",{key:"your_worksetitem_id",text:"Workset Item"}),0);

Kind regards!

Former Member
0 Kudos

Hi Angel,

thank you for your fast reply. In the meantime a friend of mine had the same idea like you. Here are the lines that do the magic. The only problem was to get only one worksetItem destroyed and not all of them:

var ws = new sap.ui.ux3.NavigationItem("RESULT",{key:"result",text:"Results"});
global.variables.worksetResult = ws;

global.variables.oShell.addWorksetItem(ws);

and after use (if the user wants to make a new selection):

global.variables.worksetResult.destroy();

Now the worksetItem is really removed and destroyed and a new worksetItem with the same ID can be instantiated.

Thanks again and kind regards,

Stefan

Answers (0)