-
1 Feb 2013 12:17 AM #1
Unanswered: Alternatives Ext.getCmp() is Ext.ComponentQuery, but how use it right?
Unanswered: Alternatives Ext.getCmp() is Ext.ComponentQuery, but how use it right?
Hello Friends!
I have problem with Ext.ComponentQuery.query().
Several days ago I have finished my first application. But there I used Ext.getCmp() to get references.
But I have read article where was explained why Ext.getCmp() is bad style. now I want to understand how works Ext.Component.Query.query() method. Here some testing example:111222.png
Ext.onReady(
function(){
Ext.create('Ext.Panel',{
renderTo:Ext.getBody(),
title:'121212',
width: 500,
height: 200,
layout:'column',
items:[
{
xtype:'button',
text:'Button',
handler:function()
{
var btn=Ext.ComponentQuery.query('textfield');
alert('some');
btn[0].hide();
btn[0].setRawValue('jjjj');
}
},
{
xtype:'textfield',
fieldValue:'text'
}
]
});
});
I cant get results how i expectedLast edited by kramal; 1 Feb 2013 at 12:22 AM. Reason: to make easy our life
-
1 Feb 2013 6:40 AM #2
You could change your button handler to do something like this:
Keep in mind that it's also perfectly fine to use itemId: 'someValue' on child components in a container. This just gives them a unique name within the parent container against which you can query:Code:handler:function(){ this.up('panel').down('textfield').setValue('jjjj'); }
-
1 Feb 2013 9:56 AM #3


Reply With Quote
