1. #1
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    21
    jep will become famous soon enough jep will become famous soon enough

      0  

    Default best practice for MVC auto-creation of views with multiple profiles

    best practice for MVC auto-creation of views with multiple profiles


    I have an app with phone and tablet profiles. It has a view with a button that brings up another view. In the tablet version, this new view is simply a floating window shown next to the button. In the phone version, it is a whole screen that is switched to.

    I'm trying to figure out what the best practice is for this situation. Is it to give each profile view a different xtype and then create two separate refs, one in each controller like:

    phone controller:
    Code:
          myView:{
            selector:'someViewPhone',
            xtype:'someViewPhone',
            autoCreate:true
          },
    tablet controller:
    Code:
          myView:{
            selector:'someViewTablet',
            xtype:'someViewTablet',
            autoCreate:true
          },
    ?

    Then in the phone controller's click for the button:

    Code:
        Ext.Viewport.add(this.getMyView());
        Ext.Viewport.setActiveItem(1);
    and in the tablet controller:
    Code:
        this.getMyView().showBy(this.getMyButton());
    ?

    Or is there some more elegant way to go about this?

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


    Each profile should have it's own controller. I usually have a base controller and have the phone/tablet controllers extend it so I can reuse that base code but put the profile specific logic in the profile controllers.
    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 jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    21
    jep will become famous soon enough jep will become famous soon enough

      0  

    Default


    Yes, mitchell, that's why I specified in my tablet that I have a phone and a tablet controller (along with the base one). My question was about what to do to create the controller-specific view. Check out my question again.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,668
    Vote Rating
    746
    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


    Checkout my reply again. If you have a base controller that can handle say a button click but what happens on that button click is profile specific, now different controllers can take over.
    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 jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    21
    jep will become famous soon enough jep will become famous soon enough

      0  

    Default


    That's what I'm doing, mitchell. I'm not asking about the controllers so much as the VIEWS. Notice my question about having two different xtypes.

  6. #6
    Sencha User siebmanb's Avatar
    Join Date
    Aug 2011
    Location
    Geneva (CH) - Grenoble (FR)
    Posts
    253
    Vote Rating
    15
    siebmanb will become famous soon enough

      0  

    Default


    I think I understand what you mean and I believe you will find your answer there : http://www.sencha.com/forum/showthre...les-amp-xtypes

Thread Participants: 2

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