1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    4
    Vote Rating
    0
    Sha90 is on a distinguished road

      0  

    Default Unanswered: Change source of an Image dynamically

    Unanswered: Change source of an Image dynamically


    I would like to change the source of my image dynamically, in a controller function using setSrc() method, but I am not able to call the image in the controller.

    This is the code of the view part where the image is:
    Code:
    Ext.define('MechanicalTerk.view.Picture', {
        extend: 'Ext.Container', 
        xtype: 'Picture',
        requires: [
            'Ext.data.Store'
        ],
        config: {
            layout: 'vbox', 
            items: 
            [
                {
                    xtype: 'toolbar',
                    docked: 'top',
                    title: 'Requests',
                    minHeight: '60px',
                    items: [
                        {
                            xtype:'button',
                            ui:'back button',
                            id:'backButton',
                            text:'Back'
    
    
                        },{
                            xtype: 'button',
                            id:'logoutButton', 
                            text: 'Logout'
                        }
                    ],          
                },
    
    
                {
                    xtype:'image',
                    height:500,
                    id:'layoutImage'
                }  
            ]
        }
    });
    Thank you so much for your help in advance...

  2. #2
    Sencha User
    Join Date
    Jun 2012
    Location
    India
    Posts
    50
    Answers
    4
    Vote Rating
    3
    girish.arjunagi is on a distinguished road

      0  

    Default


    If you want to change the image on click of button. you can query for the image component inside a button handler and set the src to new image.

    this.ownerCt.ownerCt.getComponent('layoutImage').setSrc('abc.png');

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2011
    Location
    India
    Posts
    36
    Answers
    1
    Vote Rating
    4
    vasanth.kvj is on a distinguished road

      0  

    Default dynamically while loading page or store or during any action ?

    dynamically while loading page or store or during any action ?


    Hope this will help.

    Code:
    Ext.onReady(function () {
        Ext.create('Ext.container.Container', {
            items: [{
                xtype: 'image',
                id: 'myimage',
                src: 'http://www.sencha.com/img/20110215-feat-html5.png',
            }, {
                xtype: 'button',
                text: 'click me to change the image',
                handler: function () {
                    Ext.getCmp('myimage').setSrc('http://www.sencha.com/img/20110215-feat-perf.png');
                }
            }],
            renderTo: Ext.getBody()
        });
    });
    URL: http://jsfiddle.net/3e5X2/

  4. #4
    Sencha User
    Join Date
    Mar 2013
    Posts
    4
    Vote Rating
    0
    Sha90 is on a distinguished road

      0  

    Default


    Unfortunately I get this error Thank you so much again.

    This is the controller code :
    Code:
    Ext.define('MechanicalTerk.controller.PictureController',{
    	extend:'Ext.app.Controller',
    	showPicture: function(userID,sentAt){
    		Ext.Ajax.request({
    			url:'app/Model/database.php',
    			params: {
    				functionID: 3,
    				userID: userID,
    				sentAt: sentAt,
    			},
    			success: function (response, opts){
    				Ext.getCmp('layoutImage').setSrc('http://www.sencha.com/img/20110215-feat-perf.png');
    				Ext.Viewport.setActiveItem(Ext.create('MechanicalTerk.view.Picture'));
    				}
    			});
    		}
    });

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi