PDA

View Full Version : howto find component within a form



rich71
1 Aug 2010, 5:42 PM
Hello,
I would like to find the spinner component and set a value for it without
using getCmp and a dynamic id, although that is the only function that worked sofar.

var myId = myId +d.getTime();

I try´d all a lot off diffferent approches but they all fail.
I get the idea that this problem is only related to compositefields.

Can anyone show me possibly a different way to get a reference to a component inside a compositefield?
Other techniques I could use possibly??

First off, I have a reference to the container panel set at the start off initComponent

,initComponent:function() {
var pan = this;from there I start adding items

var config = {bodyStyle:'padding:5px',autoHeight: true, defaults: { anchor: '0'},frame:true,
items:[
{xtype: 'compositefield',fieldLabel: ´blah',anchor: '-20',itemId:'boo'
items: [{xtype:´combo´,
listeners:{select: {fn: function(){
console.log(this.getValue());
test= pan.find('itemId','boo');
console.log(pan);
//Ext.getCmp('boo').setValue(8);


Thanks, Richard

Condor
1 Aug 2010, 9:56 PM
You should have a look at the 'ref' config option.

ps. Both 'ref' and find() won't find a component inside a CompositeField (open issue). I recommend using a HBox container instead.

rich71
2 Aug 2010, 6:14 AM
Thanks, I will remember that next time
For now, it does the job ok.

I hope it can do a loadrecord, - but will see about that later.