PDA

View Full Version : "cast" results of Ext.get()



edreyer
25 Apr 2008, 4:02 PM
Hi all,

Hopefully this is just a quick stupid question.

Supposing you have a FormPanel in which it contains the following item:



...
items: [
new Ext.form.NumberField({
id: 'soldPriceField',
fieldLabel: 'Sold Price',
name: 'price',
allowBlank:false,
allowNegative:false
})
],
...


Then, later you want to get this NumberField to set it's value, I've got:


Ext.get('soldPriceField').setValue(0);

This blows up because Ext.get returns an Element, which does not support setValue().

What is the correct way to "cast" this to the appropriate type?

Thanks,
Erik

evant
25 Apr 2008, 7:38 PM
Use Ext.getCmp to return components (the component must have an id).