1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    86
    Vote Rating
    0
    alohainc is on a distinguished road

      0  

    Default Routes example

    Routes example


    I want to use routes in secha touch 2 application. So it will be very helpful if any body can give simple examples on "how to use routes in sencha touch 2?".

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,782
    Vote Rating
    833
    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


    Couple of the examples like KitchenSink and TouchStyle use routes.
    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 wilzdezign's Avatar
    Join Date
    Jul 2011
    Location
    WA
    Posts
    65
    Vote Rating
    0
    wilzdezign is on a distinguished road

      0  

    Default


    The guide on History Support/Routes is given at http://docs.sencha.com/touch/2-0/#!/guide/history_support

    Though I was just looking myself for simple route so I can direct a user to a specific card/view. So for my example, I did this inside the Controller for that View:
    PHP Code:
    config:{
      
    routes: {
        
    'events''showCampusEvents'
        
    // when user types in http://domain.com/#events , function is fired
      
    }
    },

    showCampusEvents: function(){
      
    Ext.ComponentManager.get("mainTabPanel").setActiveItem(2); 
      
    // after loading of application, controller is fired and changes the
      // view to the Events view

    .. I know there must be a cleaner way or set view item based on the View name so incase I need to switch order, I don't have to go through and figure out the number on the tab items

  4. #4
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    173
    Vote Rating
    19
    kostysh will become famous soon enough kostysh will become famous soon enough

      2  

    Default


    My demo app contains a good example on how to use routes:
    https://github.com/kostysh/Sencha-To...ith-NestedList

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    86
    Vote Rating
    0
    alohainc is on a distinguished road

      0  

    Default


    Thank you all, all the examples are very useful...

  6. #6
    Sencha User
    Join Date
    Apr 2012
    Posts
    86
    Vote Rating
    -7
    CarClub is on a distinguished road

      1  

    Default


    I would say you guys do a fair job of describing how to define things in the application and a most lousy job of describing how to use what has been defined.

    function button_touched()
    {
    // need to navigate to a route, how to do it?
    // document.location.href = "myroute"; perhaps?
    // are routes
    }

    I have finally figured out the nifty idiom

    document.location.href=document.location.href.split('#')[0]+'#user/12345';

    or whatever the new route is - which seems to get me what I want.

  7. #7
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Vote Rating
    16
    tomalex0 will become famous soon enough

      2  
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






  8. #8
    Sencha User
    Join Date
    Feb 2012
    Posts
    86
    Vote Rating
    0
    alohainc is on a distinguished road

      0  

    Default


    Quote Originally Posted by CarClub View Post
    I would say you guys do a fair job of describing how to define things in the application and a most lousy job of describing how to use what has been defined. function button_touched() { // need to navigate to a route, how to do it? // document.location.href = "myroute"; perhaps? // are routes } I have finally figured out the nifty idiom document.location.href=document.location.href.split('#')[0]+'#user/12345'; or whatever the new route is - which seems to get me what I want.
    Hey I did it by simply using window.location = "#Login";

  9. #9
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,782
    Vote Rating
    833
    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


    redirectTo will not only change the hash but will check to see if you have a route handler created for it. If there isn't one then it won't change the hash.
    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.

  10. #10
    Sencha User
    Join Date
    Apr 2012
    Posts
    86
    Vote Rating
    -7
    CarClub is on a distinguished road

      0  

    Default


    OK, so how do I put up a route handler that can deal with a form post? I'm missing something here.

    form url="#login", method="post"
    input name=username,
    input name=password,
    button, handler=function(){var form = this.up('formpanel'); form.submit(); }

    create a route for 'login' : 'doLogin'

    Ext.define('MyApp.controller.LoginController', {
    extend: 'Ext.app.Controller',
    config: {
    routes: {
    'login': 'doLogin'
    },

    refs: {
    loginForm: {
    selector: '#login_form',
    xtype: 'formpanel'
    }
    }
    },

    doLogin: function() {
    var form = Ext.getCmp('login_form');
    var values = form.getValues();
    this.getApplication().authenticate(values);
    }

    });

    problem being, when doLogin has been called, page has been reloaded and form values are gone.

    I want the action triggered from form.submit because it is possible to submit the form from the Android keyboard using the "GO" button.

    This is very confusing - want to submit a form to a route via the form.submit action being triggered.

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