Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    22
    Vote Rating
    0
    lexer is on a distinguished road

      0  

    Default Tabpanel brokes practices of MVC pattern

    Tabpanel brokes practices of MVC pattern


    To create Iphone like bottom navbar I should use Tabpanel.

    The bad thing here is that instead of controller tabpanel itself is responsible to set activeitems.

    I tried to use tabbar separately from tab panel, but found that it is deeply coupled with tab panel and cannot be used without it.

    I think you should decouple tabbar from tabpanel, so it can be used as menu control, which change event could be used to controller's actions.

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Posts
    22
    Vote Rating
    0
    lexer is on a distinguished road

      0  

    Default


    I've made a hack to get it work. But I think this should be solved by framework.

    Code:
    app.views.Viewport = Ext.extend(Ext.Panel, {
                dockedItems: [
                    new Ext.TabBar({
                                dock : 'bottom',
                                ui   : 'dark',
                                layout: { pack: 'center'},
                                cardLayout: this.layout,
                                cardSwitchAnimation: this.cardSwitchAnimation,
                                items: [
                                    {
                                        iconCls: 'activity',
                                        text: 'Activity',
                                        controller: app.controllers.activity,
                                        action: 'index'
                                    },
                                    {
                                        iconCls: 'prescriptions',
                                        text: 'Prescriptions',
                                        controller: app.controllers.prescriptions,
                                        action: 'index'
                                    },
                                    {
                                        iconCls: 'doctors',
                                        text: 'Doctors',
                                        controller: app.controllers.doctors,
                                        action: 'index'
                                    },
                                    {
                                        iconCls: 'myinfo',
                                        text: 'My info',
                                        controller: app.controllers.myinfo,
                                        action: 'show'
                                    }
                                ],
                                listeners: {
                                    'render' : function(bar) {
                                        var tabs = bar.query('.tab')[0].activate();
                                    },
                                    'change': function (bar, currentTab, card) {
                                        var tabs = bar.query('.tab');
    
                                        var previousTab = null;
    
                                        for (var i = 0; i < tabs.length; i++) {
                                            if (tabs[i].active) {
                                                previousTab = tabs[i];
                                                tabs[i].deactivate();
                                            }
                                        }
    
                                        var direction = (bar.items.indexOf(currentTab) < bar.items.indexOf(previousTab)) ? 'right' : 'left';
    
                                        Ext.dispatch({
                                                    controller: currentTab.controller,
                                                    action: currentTab.action,
                                                    animation: {type:'slide', direction:direction}
                                                });
    
                                        currentTab.activate();
                                    }
                                }
                            })
                ],
    Hope you solve this in future versions.

  3. #3
    Sencha User
    Join Date
    Oct 2010
    Location
    San Diego
    Posts
    12
    Vote Rating
    0
    SpNg is on a distinguished road

      0  

    Default


    I'm running into the same problem here. I have cards that don't belong in the bottom tabbar of a tabpanel, but when I render them with the controller the tabpanl starts adding them to the tab bar. Your solution is right on point of what I'm about to write. I wonder if there is something we are missing with best practice here.

    Thanks for your post.

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    32
    Vote Rating
    1
    preyz is on a distinguished road

      0  

    Default


    Same problem here!!!

    Sencha released a new Screencast that demonstrates how to create an interface like we imagine. However, even though the example code is using a MVC-like pattern, it does not include controller files. Maybe not a coincidence? Check it out:
    http://vimeo.com/22251762

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    11
    Vote Rating
    0
    dreamdu5t is on a distinguished road

      0  

    Default


    Has anyone figured out a better solution to this? Otherwise, I'll have to use lexer's hack (thanks lexer!!!).

    This should be handled by the framework, as there is no clean way to use an MVC architecture with tabs.

  6. #6
    Sencha User interfasys's Avatar
    Join Date
    Mar 2011
    Location
    UK & Switzerland
    Posts
    125
    Vote Rating
    1
    interfasys is on a distinguished road

      0  

    Default


    It's not necessarily wrong if Sencha is trying to build a framework that contains HMVC patterns. From my point of view, it's OK to have a hierarchy for some parts of the GUI.

  7. #7
    Sencha User
    Join Date
    Jun 2011
    Posts
    11
    Vote Rating
    0
    dreamdu5t is on a distinguished road

      0  

    Default


    Quote Originally Posted by interfasys View Post
    It's not necessarily wrong if Sencha is trying to build a framework that contains HMVC patterns. From my point of view, it's OK to have a hierarchy for some parts of the GUI.
    Well it's not wrong, it just sucks that this is one of the few components that breaks the MVC pattern.

  8. #8
    Sencha User
    Join Date
    May 2011
    Posts
    9
    Vote Rating
    0
    miroamarillo is on a distinguished road

      0  

    Default


    I was starting a new project with the MVC Model proposed by the videos and suddenly I bumped with this post. What are the recommendations then?? discard the MVC model and do it with the index.js and the Ext structure with the onReady function? Any hint here would be really appreciated as I found the MVC way a bit intricate for people that is just getting to know Sencha Touch. Any advice???

  9. #9
    Sencha User
    Join Date
    Jun 2011
    Posts
    11
    Vote Rating
    0
    dreamdu5t is on a distinguished road

      0  

    Default


    Quote Originally Posted by miroamarillo View Post
    I was starting a new project with the MVC Model proposed by the videos and suddenly I bumped with this post. What are the recommendations then?? discard the MVC model and do it with the index.js and the Ext structure with the onReady function? Any hint here would be really appreciated as I found the MVC way a bit intricate for people that is just getting to know Sencha Touch. Any advice???
    You can:

    * Live with having logic in your views.
    * Use the method lexer posted above.
    * Abandon the MVC pattern altogether.

    I'd recommend using lexer's method. It would just be nice to have it in the framework.

  10. #10
    Touch Premium Member
    Join Date
    Feb 2011
    Location
    San Diego, CA
    Posts
    43
    Vote Rating
    4
    tinyfactory is on a distinguished road

      0  

    Default


    I ended up using a derivative of lexer's post. Don't use a tab panel, use a toolbar with tabs that you active on your own, and use the rendering approach of the MVC pattern. I personally really like the MVC pattern as it keeps the DOM lightweight. Just mimic the functionality of the tab panel, and use the MVC pattern.

Similar Threads

  1. Replies: 2
    Last Post: 29 Dec 2010, 9:38 AM
  2. Replies: 0
    Last Post: 6 Apr 2008, 10:49 AM
  3. Best practices for loading TabPanel dynamic content
    By bdperk in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 6 Feb 2008, 4:05 PM
  4. ie brokes my tabs :D
    By luke83 in forum Ext 1.x: Help & Discussion
    Replies: 15
    Last Post: 7 Nov 2006, 4:32 PM

Thread Participants: 8

Tags for this Thread