1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Toronto
    Posts
    105
    Vote Rating
    2
    basememara is on a distinguished road

      0  

    Lightbulb Passing MVC controller and action in query string parameters

    Passing MVC controller and action in query string parameters


    Instead of creating multiple html pages such as index.html, product.html, etc, I want to have one index.html and pass the controller and actions into the URL like this:

    http://mydomain.com/?controller=product&action=list

    ..or maybe like this:

    http://mydomain.com/?route=product/list

    Is there a way to do this or am I supposed to be approaching this differently for Touch 2?

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Routes will be part of the MVC package in ST2, they just aren't in PR2. They will do exactly what you are looking for.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Toronto
    Posts
    105
    Vote Rating
    2
    basememara is on a distinguished road

      0  

    Default


    Really hoping for that As a workaround, I put some routing logic in my viewport after adding 'autoCreateViewport: true' in my 'Ext.application':

    Code:
    Ext.define('MyApp.view.Viewport', {    extend: 'Ext.Panel',
    
    
        config: {
            fullscreen: true,
            layout: 'fit'
        },
    
    
        initialize: function() {
            //RETRIEVE QUERY PARAMETERS TO HANDLE REQUEST
            var reqParams = Ext.Object.fromQueryString(location.search);
    
    
            //ROUTE PER REQUEST
            var reqRoute = (reqParams['route'] || 'product/list').split('/');
            var reqController = reqRoute[0].toLowerCase();
            var reqAction = reqRoute.length > 1 ? reqRoute[1].toLowerCase() : 'index';
            switch (reqController) {
                case 'product':
                    switch (reqAction) {
                        case 'list':
                            this.add({ xtype: 'productlist' });
                            break;
                        case 'detail':
                            this.add({ xtype: 'productdetail' });
                            break;
                        default:
                            this.add({ xtype: 'productlist' });
                    }
                    break;
                default:
                    this.add({ xtype: 'productlist' });
            }
    
    
            this.callParent();
        }
    });
    It is an ugly hack, but conditionally adding items to the page based on the route parameters.

Thread Participants: 1

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