cancel
Showing results for 
Search instead for 
Did you mean: 

Image not showing up when added through a controller.

293
This is the xml view of Carousel with two pages added by default.

<Carousel class="sapUiContentPadding caro" loop="true" pageChanged="caroChanged"
width="60%" id="caro">
        <pages>
	    <Image id="caroImg1" src="images/dclarke_rock.jpg" />
	    <Image id="caroImg2" src="images/dex.jpg" />
	</pages>
</Carousel>
 

This is the controller of the above view in which I tried to add another page.


onInit: function(evt) {

      oPage=new sap.m.Page("caroImg3",{
             content:[
                 new sap.m.Image({
                     src:"images/wp.jpg",
                     alt : "This is Sap UI5 section"
                      })
                     ]
                   });
       this.byId("caro").addPage(oPage);
},
Images added by default are workin fine but the above added image shows like this:-

Accepted Solutions (0)

Answers (1)

Answers (1)

wridgeu
Participant

Hey,

maybe the example from the UI5 Documentation can help you out.

-UI5 Documentation

More specifically the 'onInit' and the '_setNumberOfImagesInCarousel' methods. Hope it helps.

Best regards,

Marco

maheshpalavalli
Active Contributor

true, mukherjee_gourab1998_97 just need to remove page and add the image directly to the carousel.. But marcobeier, still the page is displayed there, so image should be displayed inside that right?

wridgeu
Participant

Hey maheshkumar.palavalli I get what you mean according to his code there should be a page inside a page which then has the third picture inside of it. I don't see him declare 'oPage' as variable though.

Take a look at this plnkr: http://next.plnkr.co/edit/cjntmtuP4JW8RDtF

Anyway, both cases:

1. Directly add the image as well as

2. Add the page object with the image inside of it ...

work in the plnkr so that might help him.

Best Regards,

Marco

maheshpalavalli
Active Contributor

marcobeier, ah, so that is the issue 😄 😄

thanks for the update..