Results 1 to 6 of 6

Thread: Get all the passwordfield on the current active view

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    16

    Default Get all the passwordfield on the current active view

    Hello everyone,
    I have been trying to get all the passwordfield components that are being displayed on the current active view.

    I am trying something along the lines of the following:

    Code:
    var activeView = Ext.Viewport.getActiveItem();
    var objects = activeView.query('passwordfield');
    for (var index =0; index < objects.length;index++){
    //Do stuff
    console.log('>>> objects[i] Class name=.... : ' + Ext.getClassName(objects[i]));
    }
    The class printed is always empty and whenever I try to call any of the passwordfield's APIs I get an exception.

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149

    Default

    Trying to query the items of a view like that never worked for me, but this could work:
    Code:
    //query all direct children
    Ext.ComponentQuery.query('#activeViewItemIdHere > passwordfield');

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    631

    Default

    I bet objects[index] will work better

  4. #4
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149

    Default

    Quote Originally Posted by estesbubba View Post
    I bet objects[index] will work better
    Haha I totally did not catch that

  5. #5
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    631

    Default

    I always use Ext.each() instead of for() for arrays.

  6. #6
    Sencha User
    Join Date
    Mar 2012
    Posts
    16

    Default

    Thanks guys
    Well spotted !
    Such a stupid mistake

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •