cancel
Showing results for 
Search instead for 
Did you mean: 

getComponent in SAPUI5 Application in Fiori

0 Kudos

Hello Community,

I am facing a strange issue and I think I am stucked.

I open a MessageBox.confirm with a close method.

I want to get a specific id from the source view: "plugin_table"

In the main controller it is easy, this.getView().byId("plugin_table").

But in the method of the MessageBox, this is related to the confirmbox.

I get the value via the sap core:

sap.ui.getCore().getComponent("__component0").byId("AdminPage").byId("plugin_table")

This works in my trial station, but if i publish it to Fiori Launchpad the component will be renamed and the access doesn't work anymore.

I tried everything, either to set my own component id, but no success.

And I don't get the component in a flexible way, I always need to know the component id.

I thought with getRootComponent() I will get it, but it is always undefined.

How can I handle this, I am facing this issue at serveral places.

Please help,

BR

Marcel

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Thanks,

that was a perfect suggestion.

This eventbus function is cool and useful for many other usecases.

BR

Marcel

junwu
Active Contributor
0 Kudos

use eventbus to fire event to inform the controller to delete the record.

0 Kudos

Maybe my logic is wrong, but the idea is.

A User klicks on a delete Button. With the confirm Message Box I want to ask if the user eally wants to delete.

And in the close method I check for the answer, if the user click close, do nothing if the user click "OK" then I will delete the selected records, therefore I need to know with:

sap.ui.getCore().byId("plugin_table").getSelectedItem()

Which record I need to delete.

I think thats a normal usecase. What other possibilities I have?

BR

Marcel

junwu
Active Contributor
0 Kudos

why you want it?