1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    12
    Vote Rating
    0
    moulezim is on a distinguished road

      0  

    Default Unanswered: Query Carousel DOM elements

    Unanswered: Query Carousel DOM elements


    Hi all,
    I have created a carousel using Sencha Touch 2 and fill it with an array of HTML items.
    I am trying to query a DIV (id="myDiv2"), using jQuery, that is located in the second card of the carousel, but unfortunately i couldn't find it, however it is created in the DOM (i can see it from Chrome debugger).
    I have tried to look for that DIV using listeners for all possible events 'show', 'activate', 'painted', 'initialize', but with no luck.

    N.B: I can query DIV (id="myDiv1").

    This is my code:
    Code:
    var arrCarousel = [];
    arrCarousel.push({html:"<div id="myDiv1" width="200px" height="200px">slider 1</div>",style: 'background-color:#f00;'});
    arrCarousel.push({html:"<div id="myDiv2" width="200px" height="200px">slider 2</div>",style: 'background-color:#f00;'});
    arrCarousel.push({html:"<div id="myDiv3" width="200px" height="200px">slider 3</div>",style: 'background-color:#f00;'});
    Ext.application({
    		launch: function () {
    			Ext.create('Ext.Carousel', {
    				id:'ContainerCarousel',
    				itemId:'ContainerCarousel',
    				fullscreen: true,
    				bufferSize : 2,
    				directionLock : true,
    				defaults: {
    					styleHtmlContent: true
    				},
    				items: arrCarousel,
    				listeners:{
    					activate: function(container,newActiveItem,oldActiveItem,eOpts){
    						console.log($('#myDiv2'));
    					},
    					show: function(container,eOpts){
    						console.log($('#myDiv2'));
    					},
    					initialize: function(container,eOpts){
    						console.log($('#myDiv2'));
    					},
    					painted: function(container,eOpts){
    				                console.log($('#myDiv2'));
    					}
    				}
    			});
    		}
    	});
    In Sencha Touch 1, I could use 'afterRender' event but i don't know why this event is deprecated in Sencha Touch 2.

    Please can you help me with this issue.

    Thank you,

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Why are you using jQuery when Sencha Touch can find the elements?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    12
    Vote Rating
    0
    moulezim is on a distinguished road

      0  

    Default


    Hi Mitchell,

    Thank you for your response.
    But even if i try to use Ext.get("myDiv2") it returns undefined.
    I hope you can help me with this issue.

    Thank you.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So the element doesn't exist at that point. Once you visually see it, use the Ext.get in the console and see if it returns something.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    12
    Vote Rating
    0
    moulezim is on a distinguished road

      0  

    Default


    Hi Mitchell,

    I agree with you that the element doesn't exist at that point. But my question is why?
    Shouldn't the dom be populated with all the elements when the carousel is displayed on page ('show' event) ?
    If i place a button and query the element when the carousel is displayed i can find it.
    But this is not what i want, i need to query the element based on one of the carousel events ('activate', 'painted', 'show', 'initialize').

    I will appreciate if you can use my code and test it.

    Thanks in advance.

    Regards,

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar