-
5 Dec 2011 10:27 AM #1
Problem with xtype
Problem with xtype
Something is very wrong at the core of handling "xtype" for custom components in Touch 2. I had earlier reported a problem here.
Here's another tricky situation. Consider the following code:
Script:
Html:Code:Ext.define('Ext.ux.CustomSheet', { extend: 'Ext.Sheet', xtype: 'ext.ux.customsheet' }); Ext.setup({ onReady: function() { Ext.Viewport.add( { xtype: 'panel', layout: 'fit', items: [ { xtype: 'toolbar', docked: 'top', items: [ { xtype: 'button', text: 'Click me', handler: function() { if (!this.sheet) { this.sheet = new Ext.ux.CustomSheet({ defaults: { xtype: 'button' }, items: [ { xtype: 'button', text: 'Item 1', handler: function() { Ext.Msg.alert('', this.getText() + ' clicked.'); } }, { xtype: 'button', text: 'Item 2', handler: function() { Ext.Msg.alert('', this.getText() + ' clicked.'); } }, { xtype: 'button', text: 'Item 3' } ] }); } this.sheet.showBy(this); } } ] }, { xtype: 'panel' } ] }); } });
Please click the toolbar button 2 times in succession. You will notice that the document gets masked (for no apparent reason).Code:<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Box Layouts</title> <link rel="stylesheet" href="../../resources/css/sencha-touch.css" type="text/css"> <script type="text/javascript" src="../../sencha-touch-all.js"></script> <script type="text/javascript" src="box.js"></script> <style> </style> </head> <body></body> </html>
To me, the problem looks like with the dots in xtype for the custom component: Ext.ux.CustomSheet
Okay so, I tried to remove the dots replacing them with an underscore. Guess what, a js error is triggered as soon as I click the toolbar button.
If I eliminate both underscores as well as dots from xtype, I still get js error on clicking the button.--
Rahul Singla
-
5 Dec 2011 1:21 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
Thank you for the report.
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.
-
18 Jan 2012 9:03 PM #3Sencha - Sencha Touch Dev Team
- Join Date
- Jul 2009
- Location
- Palo Alto, California
- Posts
- 469
- Vote Rating
- 9
Dots are not valid characters for xtypes in Touch 2, underscores (or dashes) are perfectly fine. I can't re-produce the issue you described with PR3 build when changing your xtype to either "ext_ux_customsheet" or "ext-ux-customsheet".
Sencha Touch Lead Architect
-
18 Jan 2012 9:19 PM #4Sencha - Sencha Touch Dev Team
- Join Date
- Jul 2009
- Location
- Palo Alto, California
- Posts
- 469
- Vote Rating
- 9
Sencha Touch Lead Architect
-
21 Jan 2012 12:26 PM #5
Okay Jacky, I am gonna test it by replacing with underscors with my current PR 3 code, hopefully it would work fine as you mentioned.
--
Rahul Singla
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote