PDA

View Full Version : Unrecognized alias error trying to build native



alexesc
5 Nov 2012, 4:57 PM
Follow my code. When I try to build a native app, then get an error "Error: [Ext.createByAlias] Cannot create an instance of unrecognized alias: widget.FieldSet". What's missing?



Ext.define("Myapp.view.Main", {
extend: 'Ext.tab.Panel',
requires: [
'Ext.form.FieldSet',
'Ext.Video'
],
config: {
id: 'headlosspanel',
items: [
{
xtype: 'FieldSet',
title: 'Headloss calculator',
items: [
{
xtype: 'numberfield',
itemId: 'mynumberfield',
name: 'A',
placeHolder: 'Default Value = 0'
},
{
xtype: 'numberfield',
inputCls: '',
name: 'B',
placeHolder: 'Default Value = 0'
},
{
xtype: 'numberfield',
name: 'C',
readOnly: true
}
]
},
{
xtype: 'button',
itemId: 'mybutton',
text: 'Calculate'
}
],
listeners: [
{
fn: 'onMybuttonTap',
event: 'tap',
delegate: '#mybutton'
}
]
},


onMybuttonTap: function(button, e, options) {
var formhl = Ext.getCmp('headlosspanel');
var values = formhl.getValues();
var A = values.A;
var B = values.B;
var C = A + B;
formhl.setValues({C: C});
}


});

vietits
5 Nov 2012, 5:17 PM
What do you mean "build a native app"? alias for Ext.form.FieldSet is "fieldset" not "FieldSet". Try to fix your code as below:


...
config: {
id: 'headlosspanel',
items: [{
// xtype: 'FieldSet',
xtype: 'fieldset',
title: 'Headloss calculator',

alexesc
5 Nov 2012, 6:25 PM
Thank you. That's solved the error.

alexesc
5 Nov 2012, 6:40 PM
I wanted to say using "sencha app build native" command.
The application is successfully packaged now, but nothing appeared in iOS Simulator. When I change numberfield by textfield, then worked. What can be the reason? Thank you