1. #1
    Ext User
    Join Date
    Jul 2010
    Posts
    26
    Vote Rating
    0
    achapman is on a distinguished road

      0  

    Question Prevent Swipe on Carousel

    Prevent Swipe on Carousel


    Does anyone know if it is possible to keep the user from swiping the carousel to go from one card to another? I have set draggable to false and that doesn't do it.

  2. #2
    Ext User
    Join Date
    Jul 2010
    Posts
    26
    Vote Rating
    0
    achapman is on a distinguished road

      0  

    Default


    I did some digging in the source code and it looks like the carousel was not designed to have this functionality.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Why would you want to prevent the user to navigate the Carousel? If thats the case you could skip using a carousel at all, and just use a Container with a card layout. You can programmatically change the card using setCard whenever you want.

  4. #4
    Ext User
    Join Date
    Jul 2010
    Location
    Amsterdam
    Posts
    4
    Vote Rating
    0
    eterps is on a distinguished road

      0  

    Default


    > Why would you want to prevent the user to navigate the Carousel?

    I can imagine you would want to prevent navigating to the next Carousel item temporarily.
    Some native iPhone apps have Carousel like functionality where a user can pinch-zoom in on one of its items, pan around, pinch-zoom out to 1:1 level again and resume swiping the Carousel to its next item.
    In fact I want to implement such behaviour in my Sencha app, although I am also in the process of learning Sencha/Ext itself.

  5. #5
    Ext User
    Join Date
    Jul 2010
    Posts
    26
    Vote Rating
    0
    achapman is on a distinguished road

      0  

    Default


    Quote Originally Posted by TommyMaintz View Post
    Why would you want to prevent the user to navigate the Carousel? If thats the case you could skip using a carousel at all, and just use a Container with a card layout. You can programmatically change the card using setCard whenever you want.
    That is essentially the idea I was going for. Can you point me to a simple example showing how to do this?

    Here is what I am trying to accomplish.

    I have a panel with a form, a panel with a carousel, and a panel to display a graph. The form when submitted grabs the data from a select and dynamically builds three or more cards that are added to the carousel and then displays the panel containing the carousel. Each card of the carousel has a graph button that when clicked builds a graph (through Google) of the data in the table on the current card and displays the graph panel.

    The problem I am now having is that to dynamically build the carousel I call removeAll, add my cards with data, and then doLayout and setCard(x) (to overcome the indicator issue when dynamically adding cards). When my main panel is set to layout 'card', the carousel gives me an error saying that there is no method 'setCard()', but if my main panel is set up as a carousel itself, everything works well except for the user being able to swipe in the main panel.

    I hope that all makes sense.

  6. #6
    Ext User
    Join Date
    Jul 2010
    Posts
    26
    Vote Rating
    0
    achapman is on a distinguished road

      0  

    Default


    Ok, it looks like it is an issue with dynamically building the carousel content.

    Here is a simplified version of the code that builds the carousel.

    Code:
     
    var getData = function() {
      Ext.getCmp('carousel1').removeAll(true);                                
      Ext.getCmp('carousel1').add(new Ext.Panel({id: 'card1', title: 'Card 1',scroll: 'vertical', layout: {type:'vbox'}}));
      Ext.getCmp('carousel1').add(new Ext.Panel({id: 'card2', title: 'Card 2',scroll: 'vertical', layout: {type:'vbox'}}));
      Ext.getCmp('carousel1').add(new Ext.Panel({id: 'card3', title: 'Card 3',scroll: 'vertical', layout: {type:'vbox'}}));
     
      Ext.getCmp('card1').add(Ext.getCmp('button2'));
      Ext.getCmp('card2').add(Ext.getCmp('button3'));
      Ext.getCmp('card3').add(Ext.getCmp('button4'));                             
     
      Ext.getCmp('carousel1').doLayout();
      Ext.getCmp('carousel1').setCard(0);                                
      Ext.getCmp('mainNav').setCard(1);
    };
    If I don't build dynamically, and place the carousel in a panel with a card layout, it works fine. But when I build the carousel like in the code above and place it in a panel with a card layout, I get an error saying that the carousel doesn't have a method setCard().

    Like I metioned before, though, if the main navigation panel is a carousel instead, then the 'child carousel' works and doesn't give me any errors.

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,828
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Please try and post drop in test cases. It's difficult to diagnose issues if you only show portions of your code.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #8
    Ext User
    Join Date
    Jul 2010
    Posts
    26
    Vote Rating
    0
    achapman is on a distinguished road

      0  

    Default


    I attached the whole test project. There are two mainNavs, the one that works and the one that doesn't so that you can see what is happeneing.

    This test isn't setup to get to the graph panel even though it is there. I was only worried about testing the carousel.
    Attached Files

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Ok, I see what you are trying to do now. I will look into a way to support temporarily disabling the swiping on a Carousel. For now you would have to go to the source code of Carousel, and see if you can find a "hack" that you can apply to achieve this.

  10. #10
    Ext User
    Join Date
    Jul 2010
    Posts
    26
    Vote Rating
    0
    achapman is on a distinguished road

      0  

    Default


    Should it work the way you suggested, by using a container with the layout as card? I really don't see why that wouldn't work. If I create the cards and add them to the carousel when rendering everything, it works, it just seems to bomb when I try to use a dynamically generated carousel.

Similar Threads

  1. Video in Carousel
    By ludm in forum Sencha Touch 1.x: Discussion
    Replies: 7
    Last Post: 30 Mar 2011, 1:11 PM
  2. [OPEN] [FIXED-110] Carousel indicator breaks down after changing carousel content.
    By Mphasize in forum Sencha Touch 1.x: Bugs
    Replies: 6
    Last Post: 1 Jul 2010, 11:41 AM
  3. Vertical Carousel
    By simon.betton in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 24 Jun 2010, 11:10 AM
  4. Carousel on Android
    By VinylFox in forum Sencha Touch 1.x: Bugs
    Replies: 3
    Last Post: 21 Jun 2010, 2:05 PM
  5. Carousel
    By doron447 in forum Ext: Q&A
    Replies: 8
    Last Post: 9 Jul 2009, 1:25 AM

Thread Participants: 5

Tags for this Thread

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