View Full Version : newb to extjs and javascript. I was wondering how I can do this without ext.getCmp

9 Jul 2013, 2:59 PM
hi guys so I'm just trying to familiarize myself with javascript and learn some of the extjs utilities.

I tried creating some basic forms. I wanted to clone the forms really easy so I tried making a class then just instantiating objects of that class... but when I make more than one object the output isn't right the 2nd, 3rd,.... n panels don't look right.

I was thinking it's because of the ext.getCmp function or because I'm using ext. create but i couldn't figure out to extend, I'm very very new to both js and extjs. here's my code.

Ext.define('ryan', {


// extend: 'Ext.form.Panel'

name: 'mypanel',
title: 'Animal sanctuary, one animal per location ',
width: 300,
bodyPadding: 10,
test: 'mycat',
style: 'background-color: #Fdd;',
renderTo: Ext.getBody(),

items: [{
id: 'button1',
xtype: 'button',
text: 'click the button',
handler: function() {
id: 'wildAnimal',
xtype: 'textfield',
fieldLabel: 'animal:',
name: 'myanimal'
}, { //end text field
id: 'myCombo',
xtype: 'combo',
fieldLabel: 'choose your animal',
store: animals,
queryMode: 'local',
displayField: 'name',
listeners: {
'change': function(field, selectedValue) {
}// end combo

] //end items

}); // end .create
}); //end .onready
}// end func

}); //end define ryan

var animals = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
data: [{
"id": 'mycat',
"name": "mycat"
}, {
'id' : 'mydog',
"name": "mydog"
}, {
'id' : 'sbBarGirls',
"name": "BarGirls-when-drunk"

}); //end animals.create

var a = Ext.create('ryan');

//var b = Ext.create('ryan'); //this is where things go nuts
//var c = Ext.create('ryan');

10 Jul 2013, 8:45 AM
I added itemid for 'wildanimal' and started calling it using this.up('form').down('#wildAnimal').setValue(selectedValue); in my listeners which didn' really help the end result. so I guess it's not get.cmp

10 Jul 2013, 9:06 AM
oh I fixed it by changing al my ID's to itemId's not quite sure why that works just read to do so.... but I am looking into it.