-
12 Sep 2012 5:41 AM #1
What to use instead of id's????
What to use instead of id's????
I am trying to reuse some view, but I have conditions based on if the user is logged in or not. I am doing a hide and show on the different items. Of course, when I use id and the getCmp, I get errors because the id's have already been used.
I saw a post for itemid, but that doesn't seem to be working. Each item is a unique xtype, something like this:
items: [
{
xtype: 'comment_form_MPF'
},
{
xtype: 'comment_not_logged_in_MPF'
}
],
Isn't there away to get the xtype??
Any suggestions would be great.
-
12 Sep 2012 5:43 AM #2
Sencha/Java evangelist
Author of ExtJS 4 First Look and Mastering Ext JS books
English blog: http://loianegroner.com
Portuguese blog: http://loiane.com
Sencha Examples: https://github.com/loiane
-
12 Sep 2012 5:47 AM #3
Makes sense. The Ext.ComponentQuery.query doesn't seem to have any methods. How would I hide and show?
Uncaught TypeError: Object [object Object] has no method 'hide'
-
12 Sep 2012 5:52 AM #4
Query is simply used to gain access to the control. Then you issue the method
Scott.Code:var form = Ext.create('Ext.form.Panel', { title: 'Contact Info', width: 300, bodyPadding: 10, renderTo: Ext.getBody(), items: [{ xtype: 'textfield', name: 'name', itemId: 'mytextfield', fieldLabel: 'Name' }, { xtype: 'textfield', name: 'email', fieldLabel: 'Email Address' }] }); // same premise as using query var tfield = form.down('#mytextfield'); tfield.hide();


Reply With Quote