-
2 Jul 2012 12:17 PM #1
sencha app build production works without tap events
sencha app build production works without tap events
Hi all
Im new to ST2 and not sure if this is a bug, but I've really tried a lot of different things to make it work.
My app is created from scratch using the command:
sencha app create MyApp /path/to/www/myapp
It works great locally (using python on a mac) and uses carousels and images with tap events. Also I get no console warnings or errors.
When I change the index.html to use production.js and deploy I can't build at all, getting this error:
[ERROR] TypeError: 'undefined' is not a function
phantomjs://webpage.evaluate():7
phantomjs://webpage.evaluate():1
/Users/cphnmnn/Documents/Eclipse/WebApps/Playground/sdk/command/vendor/phantomjs/dependencies.js:36
When I deploy without changing anything in index.html or app.json (which mean I use the development.js) the app seems to work, but nothing happens when I click on my image.
I don't think the build has my included tap events. Cant see how it includes my app.js which now is minified.
Am I missing some build steps to deploy?
-
2 Jul 2012 1:09 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
You shouldn't modify index.html, to go to a production you should build
sencha app build production
I would recommend build in testing to see any errors before you jump into production
sencha app build testingMitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Jul 2012 1:30 PM #3
Hi Mitchell
I've noticed that you reply really quick - thumbs up!
However, I've tried with the "testing" deployment which unfortunately produced the same error free result.
Also, I can see I wrote a mistake - the app.js is included fine, but it's the other js files I can't find in the resources that the client download when accessing the site.
The main thing that bugs me, is that it loads a view, that was defined in another js file than app.js, fine, but a simple call to Ext.Msg.alert when tapping on a image doesn't work....
-
2 Jul 2012 1:58 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
For testing I do this and it works switch tabs (which are just buttons really)
cd /path/to/sencha-touch-2.0.1.1
sencha app create MyApp ../MyApp
cd ../MyApp
--edit app.json's logger config to false
sencha app build testing
Open the testing build and I can interact with the tabs just fine.
To go further, I added a button to the first item with a simple console.log in both the handler config and tap listener and it works.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Jul 2012 9:49 PM #5
Hi again
Its almost like you describe that I created my app, however I tried again with a fresh app and it worked! I've added images with tap-events that call Ext.Msg.alert, deployed to testing and it worked!
So there must be something in my real app, that the build doesn't like, but now I can keep adding small bits of my app to test.
Thanks for pointing me in the right direction! When I find then problem, I can write it here if you like?
-
2 Jul 2012 11:21 PM #6
So I finally found the error, but it leaves me with a design question. I found out, that I created my panels wrong in a tab panel like this:
Ext.define("Playground.view.Main", {
extend: 'Ext.TabPanel',
requires: [
'Ext.Anim',
'Ext.Img'
],
config: {
title: 'Main',
tabBarPosition: 'bottom',
layout:{
pack:'center',
align: 'stretch'
},
defaults: {
styleHtmlContent: true
},
listeners: {
initialize: function(thisPanel, eOpts){
thisPanel.setActiveItem(0);
}
},
items: [
Ext.create('Playground.view.Info')
]
}
});
The point is, that my view 'Playground.view.Info' (which extends Panel) comes from another file to keep a better design, but when I create it like above, the alerts stops working (only when deploying worth noticing!). If I use the code directly, it works.
So is this a bug, a poor design or bad programming?
-
2 Jul 2012 11:35 PM #7
You should put items into the config curly brackets.
If you want to have your Info panel as an item, you should use its xtype.
Something like this:
HTML Code:Ext.define("Playground.view.Main", { extend: 'Ext.TabPanel', requires: [ 'Ext.Anim', 'Ext.Img', 'Playground.view.Info' ], config: { title: 'Main', tabBarPosition:'bottom', layout:{ pack:'center', align:'stretch', defaults: { styleHtmlContent:true }, items: [{ xtype: 'playground-info' // for instance. Instead of Ext.create('Playground.view.Info') }] }, listeners: { initialize: function(thisPanel, eOpts){ thisPanel.setActiveItem(0); } });
-
3 Jul 2012 2:45 AM #8
Wow, this actually solves my problem!
So the conclusion is a combination of my misuse of the syntax and a bug(?) that the deployment process is more sensitive (due to the development branch works fine).
Thanks guys!
-
3 Jul 2012 3:59 AM #9Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
It's not really a bug, using Ext.create before Ext.application's launch method has fired will screw interactions up as things are not ready for an instance.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Jul 2012 4:25 AM #10
Yes, I agree, that I didn't used it correctly.
I was just confused since I didn't got any errors or warning during development and the interactions worked fine.
But okay, it lead me to really learn about the build process :-)
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote