1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Vote Rating
    0
    varun.upadhyay is on a distinguished road

      0  

    Default New in Sencha

    New in Sencha


    How to add a simple Button through view ? Momo.zip i have attached my code with this. Please help me. I am new learner in this.

  2. #2
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Vote Rating
    0
    varun.upadhyay is on a distinguished road

      0  

    Default


    My code is like this.. Don't need to download the zip file

    Folder architecture:
    folders.jpg



    index.html
    Code:
    <html>
    <head>
        <title>SomeThing</title>
        <!-- Ext JS Files -->
        <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
        <script type="text/javascript" src="extjs/ext-debug.js"></script>
        
        <!-- App Files -->
        <script type="text/javascript" src="app.js" ></script>
    </head>
    <body></body>
    </html>
    app.js
    Code:
     Ext.application({
        name: "Momo",
        views: ["Main"],
        
        launch: function() {
            Ext.Viewport.add(Ext.create('Momo.view.Main'));
        }
    });
    Main.js
    Code:
    Ext.define('Momo.view.Main', {
        extend: 'Ext.Button',
    
        config: {
                text: "Click Me",
                renderTo: Ext.getBody(),
                handler: function(e) {
                    this.setText( e );
                }
        }
    });

  3. #3
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    450
    Vote Rating
    66
    suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice

      0  

    Default


    Hi.
    Have a look here http://docs.sencha.com/ext-js/4-1/#!/guide/getting_started

    Look at section 2.1 to give you some guidance.
    Have you previously worked with Sencha Touch? There is no Ext.Viewport singleton in ExtJS, unlike the Touch framework.
    You need to create the viewport instance first

    Code:
    Ext.create("Ext.container.Viewport",
    You also dont need the renderTo as you have added it to the viewport.
    renderTo wont play nice with a containers layout manager so should only be used for specific reasons. Just add it to the container

  4. #4
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Vote Rating
    0
    varun.upadhyay is on a distinguished road

      0  

    Default Thanks

    Thanks


    Thanks for the reply with best suggestion. I haven't worked in this, yet. I am a flash developer and want to learn new things always. So I am working in this now.

    I got to know about this from below link actually. So I was also not aware of ExtJS Viewport before.
    http://pages.sencha.com/flex-to-sencha.html

    Again thanks for the reply.

Thread Participants: 1

Tags for this Thread