1. #1
    Sencha User hipertracker's Avatar
    Join Date
    May 2010
    Posts
    4
    Vote Rating
    0
    hipertracker is on a distinguished road

      0  

    Question How to build first_app example from touch2 docs in the Designer?

    How to build first_app example from touch2 docs in the Designer?


    I try to create http://docs.sencha.com/touch/2-0/#!/guide/first_app example in Sencha Designer 2 but I can't. I cannot add handler to submit button (and the Designer does not allow me to edit that code). I can add only onMyButtonTab event. It works for simple new Ext.MessageBox().alert('hello','world'); but I cannot submit anything. The command this.up('formpanel').submit() raises exception Uncaught TypeError: Cannot call method 'submit' of undefined.So the form is not even found...

    Maybe I am missing something because Designer display warning icon on the right side of Project Inspector tap onMyButtonTap with message "A valid function must have fn set. In addition, a function of a non top level component must match a configuration." I have not a clue what should I do with this. That's what has been generated by Designer:

    Code:
    Ext.Loader.setConfig({
        enabled: true
    });
    
    Ext.application({
        views: [
            'MyTabPanel'
        ],
    
    
        name: 'MyApp',
    
    
        launch: function() {
            Ext.create('MyApp.view.MyTabPanel', {fullscreen: true});
        }
    });
    Code:
    Ext.define('MyApp.view.MyTabPanel', {
        extend: 'Ext.tab.Panel',
    
    
        config: {
            tabBar: {
                docked: 'bottom'
            },
            items: [
                {
                    xtype: 'container',
                    title: 'Tab 1',
                    iconCls: 'info'
                },
                {
                    xtype: 'formpanel',
                    url: 'demo.php',
                    title: 'MyFormPanel',
                    iconCls: 'info',
                    items: [
                        {
                            xtype: 'fieldset',
                            title: 'MyFieldSet',
                            items: [
                                {
                                    xtype: 'textfield',
                                    label: 'Field'
                                }
                            ]
                        },
                        {
                            xtype: 'button',
                            itemId: 'mybutton',
                            text: 'MyButton'
                        }
                    ]
                }
            ],
            listeners: [
                {
                    fn: 'onMybuttonTap',
                    event: 'tap',
                    delegate: '#mybutton'
                }
            ]
        },
    
    
        onMybuttonTap: function(button, e, options) {
            new Ext.MessageBox().alert('Hello', 'World');
            this.up('formpanel').submit();
    
    
        }
    
    
    });
    Screen Shot 2012-03-21 at 03.32.21.png

  2. #2
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    500
    Vote Rating
    41
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default


    At a high level you should add a controller to your project and listen for that button click then execute your code within a controller action... you also add to the controller.

  3. #3
    Sencha User hipertracker's Avatar
    Join Date
    May 2010
    Posts
    4
    Vote Rating
    0
    hipertracker is on a distinguished road

      0  

    Default


    Quote Originally Posted by BostonMerlin View Post
    At a high level you should add a controller to your project and listen for that button click then execute your code within a controller action... you also add to the controller.
    1) But how to do it with Designer? I mean what code should I write or choose in Designer to get that form binding?
    2) Does it mean onMyButton event is wrong? It works when I tap on the button, I only don't know how to submit the from from that place and this.up('formpanel') cannot find my form.
    3) Does it also mean I cannot create the same code in Designer as that first_app?

  4. #4
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    500
    Vote Rating
    41
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default


    first off, search for the sencha designer 2 videos and watch. The SenchaCon 2010 video on the new Sencha Designer will help. It'll answer most of your high level questions.

    more specifically, to listen for that button click....

    within the Designer:
    • Add a controller
    • Drag a Controller Action onto your controller
    • Set the controller actions controlQuery, function name and target type to reference the button you want to respond to (all through the designer UI)
    • within the function you just defined, do something when that button is clicked.
    Hope that helps,
    John

  5. #5
    Sencha User hipertracker's Avatar
    Join Date
    May 2010
    Posts
    4
    Vote Rating
    0
    hipertracker is on a distinguished road

      0  

    Default


    Chrome inspector and debuger rulez. The solution was to just add this.submit() instead of this.up('formpanel').submit(). There is no need to use overcomplicated (and unclear for beginners) constructs. For beginning the less additional concepts the better. From the learning perspective, this is very bad and confusing to use too many new concepts at the same time.

  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,892
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Thanks for the post hipertracker and for the help BostonMerlin.

    In Designer, we automatically generate code that will maintain your scope and you don't have to worry about finding the "location" of "where" you are in the hierarchy.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Sencha User
    Join Date
    Oct 2010
    Posts
    39
    Vote Rating
    0
    ashapiro75 is on a distinguished road

      0  

    Default


    Ahh, but this is confusing in and of itself. I'm so used to . Notation and that was possible working with code. I can't do that now. Plus there is ID and ItemID and two different methods for this.. I'm so confused...lol


    I was trying to get a button a in a panel to tell a sibling to that panel to change it's active state and I for the life of me failed, attempt after attempt...


    I like the designer because it is getting me closer and closer to flash.

    I guess this is just more of a gripe than anything else.. .I'm just trying to learn this and I'm struggling.

    The biggest issue I have right now is that I don't know Sencha Touch well enough to discern if a problem I am having is because 1) I don't know what I am doing or 2) there is a bug in the designer software...

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