cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove duplicate id error ??

Former Member
0 Kudos

Hi,

On clicking on account tile first time, its working properly. But, when I navigate back and then try again, its not working, it throws an error duplicate id error.

View Entire Topic
chirag_maladkar
Explorer

You may be adding tiles again to the same page during navigation.

Implement a check if a tile by the said ID is already present by using:


if ( ! sap.ui.getCore().byId( "tile_Id" ) ) {

     // Add tile to page here

}

This should solve your problem.

Regards,

Chirag

Former Member
0 Kudos

But how many ids will i need to destroy??

please tell me if any other possibility is there??

thanks

Vishnu Gupta

chirag_maladkar
Explorer
0 Kudos

No need to destroy anything.

Just add the element, if an element of same ID is not present.

The problem is that your code is adding the element of same ID.

Or, if possible, just remove the IDs & let the app handle the IDs.

Regards,

Chirag

Former Member
0 Kudos

This is because of re-open my tile but this is basic need of my app.

How can App handle ids ??  Please let me know by some Example..

Regards

Vishnu

former_member182372
Active Contributor
0 Kudos

wherever you create that control with ID salesOrderListItem call

this.getView().addDependent(salesOrderListItemControl);

so it will be destroyed when component is destroyed

chirag_maladkar
Explorer
0 Kudos

Just don't provide IDs to tiles.

ID will be assigned to each element at runtime by app.

But the negative side would be that you won't be able to use sap.ui.getCore().byId("ID"), as you won't know the exact ID.

It would be helpful if you shared the code where you are adding the tiles.

The problem resides there.

Regards,

Chirag