Results 1 to 6 of 6

Thread: [SOLVED]how to fetch all components which extends Ext.form.Field in a FormPanel?

  1. #1
    Ext User madkris's Avatar
    Join Date
    Jul 2009
    Location
    Philippines
    Posts
    49

    Thumbs up [SOLVED]how to fetch all components which extends Ext.form.Field in a FormPanel?

    This one doesnt work.
    Code:
    var components = this.findByType(Ext.form.Field, true);
    for (var j = 0; j < components.length; j++)
    {
       components[j].disable();
    }
    Last edited by madkris; 18 Jul 2010 at 10:11 PM. Reason: resolved

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    findByType('field')

  3. #3
    Ext User madkris's Avatar
    Join Date
    Jul 2009
    Location
    Philippines
    Posts
    49

    Default

    Forgot to mention that I tried that too. Doesn't seem to work or maybe I misunderstood the docs?

  4. #4
    Sencha User
    Join Date
    Nov 2009
    Posts
    61

    Default

    shallow : Boolean
    (optional) False to check whether this Component is descended from the xtype (this is the default), or true to check whether this Component is directly of the specified xtype.
    You set the second parameter to true. So, according to the documentation you are looking for components that are field xtyped (not descended xtypes). Now the title of the thread specify that you are extending Ext.form.Field if I'm right.

    Code:
    var components = this.findByType('field');
    for (var j = 0; j < components.length; j++)
    {
       components[j].disable();
    }

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    findByType works. It just does.



    You are sure what "this" is when that runs? Because you have debugged BY STEPPING THROUGH CODE haven't you?

  6. #6
    Ext User madkris's Avatar
    Join Date
    Jul 2009
    Location
    Philippines
    Posts
    49

    Thumbs up

    @tomtom - Thanks, for the explanation! Actually I wasn't Extending Ext.form.Field, Ext JS already did that for me.

    @Animal - Yes, of course. Sorry I missed that you omitted the second parameter.

    Might not be worth posting but it might help someone.

    From:
    Code:
    var types = ['textfield', 'radio', 'radiogroup'];
    for (var i = 0; i < types.length; i++)
    {
      var components = this.findByType(types[i], true);
      for (var j = 0; j < components.length; j++)
      {
        components[j].enable();
      }
    }
    To:
    Code:
    var components = this.findByType('field');
    for (var j = 0; j < components.length; j++)
    {
      components[j].enable();
    }

Similar Threads

  1. Problem with select field in Ext.form.ComboBox in Ext.form.FormPanel
    By philiparad in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 9 Feb 2010, 11:03 PM
  2. Fetch all ExtJs components of a particular xtype
    By r_honey in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 3 Jan 2010, 11:26 AM
  3. Replies: 2
    Last Post: 17 Dec 2009, 11:59 PM
  4. How to fetch specific value from item of Ext.FormPanel
    By puremonkey2009 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 11 Sep 2009, 2:05 AM

Posting Permissions

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