1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    56
    Vote Rating
    0
    markgogreen is on a distinguished road

      0  

    Default 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.

  2. #2
    Sencha User loiane's Avatar
    Join Date
    Aug 2009
    Posts
    181
    Vote Rating
    50
    loiane is a jewel in the rough loiane is a jewel in the rough loiane is a jewel in the rough

      0  

    Default


    Use Ext.ComponentQuery.query('your_xtype')

    http://docs.sencha.com/ext-js/4-1/#!...ComponentQuery
    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

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    56
    Vote Rating
    0
    markgogreen is on a distinguished road

      0  

    Default


    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'




  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,637
    Vote Rating
    400
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Query is simply used to gain access to the control. Then you issue the method

    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();
    ​
    Scott.

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar