-
11 Jul 2012 11:07 PM #1
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.
-
11 Jul 2012 11:21 PM #2
My code is like this.. Don't need to download the zip file
Folder architecture:
folders.jpg
index.html
app.jsCode:<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>
Main.jsCode:Ext.application({ name: "Momo", views: ["Main"], launch: function() { Ext.Viewport.add(Ext.create('Momo.view.Main')); } });
Code:Ext.define('Momo.view.Main', { extend: 'Ext.Button', config: { text: "Click Me", renderTo: Ext.getBody(), handler: function(e) { this.setText( e ); } } });
-
12 Jul 2012 12:03 AM #3
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
You also dont need the renderTo as you have added it to the viewport.Code:Ext.create("Ext.container.Viewport",
renderTo wont play nice with a containers layout manager so should only be used for specific reasons. Just add it to the container
-
12 Jul 2012 1:10 AM #4
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.


Reply With Quote