Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    11
    Vote Rating
    6
    airaid is on a distinguished road

      0  

    Default Unanswered: First app, wrong approach?

    Unanswered: First app, wrong approach?


    My app represents a flowchart. I have a number of views, each with some descriptive html and 2 or 3 buttons (yes/no/maybe) each of which loads the next appropriate view. For example clicking 'yes' on view 1 will load view 2. Clicking 'no' on view 1 will load view 3, etc. No more than 30 views total.

    I also have a dedicated home view and about view.

    My viewport (Ext.tab.Panel) loads my custom xtypes homepanel (Ext.Panel for my home view), aboutpanel (Ext.Panel for my about view) and pathwaycontainer (Ext.navigation.View for the 'flowchart').

    Pathwaycontainer loads my first 'flowchart' view with the custom xtype 'onepanel' which represents my view One.js.

    Code:
    Ext.define('MyApp.view.Pathway',{
        extend: 'Ext.navigation.View',
        xtype: 'pathwaycontainer',
    
    
        config: {
            title: 'Pathway',
            iconCls: 'arrow_right',
            items: [
                {
                    xtype: 'onepanel'
                }
            ]
        }    
    });
    I had hoped that I could use view.push({xtype: 'twopanel'}) on the button handler in One.js to push my next view and auto create the back button but this errors with 'view is not defined'. One.js (shortened):

    Code:
    Ext.define('MyApp.view.One', {
        extend: 'Ext.Panel',
        xtype: 'onepanel',
    
    
        config: {
            title: 'One',
            iconCls: 'info',
            items: [
                {
                    title: 'One'
                },
                {
                    html: 'The question',
                },
                {
                    xtype: 'button',
                    text: 'Yes',
                    handler: function() {
                        view.push({
                            xtype: 'twopanel'
                        });
                    }
    
    
                }
            ]
        }
    });
    So my question is, is Ext.navigation.View the right approach and if so, how do I push my views when each view is self contained within its own file?

    Thanks for any help.

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    548
    Answers
    6
    Vote Rating
    18
    estesbubba will become famous soon enough

      0  

    Default


    You should make a controller that creates the navigation view and pushes flow views onto it. It should also listen for events on each flow view and make decisions on which view to push next. None of your flow views should know about the navigation view or controller. They should be dumb and just render based on the supplied config.

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    11
    Vote Rating
    6
    airaid is on a distinguished road

      0  

    Default


    Thanks estesbubba, I think I understand what you mean but the implementation is beyond my current abilities. I'll keep working at it but if you're aware of any examples that demonstrate this I'd appreciate it.

  4. #4
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    548
    Answers
    6
    Vote Rating
    18
    estesbubba will become famous soon enough

      0  

  5. #5
    Sencha User
    Join Date
    Dec 2012
    Posts
    11
    Vote Rating
    6
    airaid is on a distinguished road

      0  

    Default


    Thanks but that's too vague. I've read the docs in detail, followed many tutorials and watched lots of videos but Touch is a very steep learning curve for me. The logic still hasn't fallen into place so without concise examples I'm still swimming. Appreciate you answering though.

  6. #6
    Sencha User
    Join Date
    Dec 2012
    Posts
    11
    Vote Rating
    6
    airaid is on a distinguished road

      0  

    Default


    I must be looking at this wrong. At what point would you suggest I create the navigation view from the controller? Should I be researching doing this from a button click (from my tab bar icon) or looking at an automated event like init maybe?

Thread Participants: 1

Tags for this Thread