PDA

View Full Version : Question about component reference and id and ref



elgs
5 Oct 2010, 8:33 PM
I'm quite new to Extjs and Ext Designer, and I have been struggling playing with it for a few days. But I still have some conceptual questions on component reference and the id and ref.

Question 1:
I use Extjs + DWR in my application. I can access the
<img id="pwCardImg" /> by using the following code:

dwr.util.setValue('pwCardImg', data.image);. However, I cannot access other components which id's or autoRef's were specified in the Ext Designer using the same way in DWR.


{
xtype: 'button',
text: 'Login',
width: 80,
height: 40,
ref: '../../../loginBtn',
id: 'loginBtnId'
},


Also, when I use firebug to inspect the dom tree, I found the id inspected from firebug looked like an auto-generated one instead of the one I specified in Ext Designer, which looks something like this: "ext-gen126". What's the relationship between the id I specified, and the generated one then?

Question 2:
How to pass argument on to a event handler? I can do it without any argument.

MyContainer = Ext.extend(MyContainerUi, {
initComponent : function() {
MyContainer.superclass.initComponent.call(this);
this.loginBtn.on('click', this.onLogin, this);
},

onLogin : function() {
// LoginService.login();
// window.location.href = "../AppWindow/index.html";
}
});