Results 1 to 5 of 5

Thread: FieldSet: uses vs requires

  1. #1
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,412
    Answers
    20
    Vote Rating
    677
      -1  

    Default FieldSet: uses vs requires

    I just noticed that new checkbox config. This is going to be useful, but I'm pretty sure the uses config should be replaced with the requires config. The checkbox class should be loaded before the FieldSet class is instantiated.
    Code:
    Ext.define('Ext.form.FieldSet', {
        ...
        uses: ['Ext.form.field.Checkbox', 'Ext.panel.Tool', 'Ext.layout.container.Anchor', 'Ext.layout.component.FieldSet'],
        ...
        /**
         * @cfg {Object} checkbox
         * A configuration for the generated checkbox that is adjacent to the {@link #title} in the header.
         * This config is only effective when {@link #checkboxToggle} is true
         *
         * @since 6.2.0
         */
        checkbox: null,
        ...

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,268
    Answers
    3990
    Vote Rating
    1468
      0  

    Default

    uses just means that class wants them to be loaded and included in a build. requires of course says that too but affects where it's included, before that class and will defer class defining until all the required classes are loaded and defined. For example, Ext.form.field.Checkbox isn't required for Ext.form.FieldSet to be defined so uses is ok there.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,412
    Answers
    20
    Vote Rating
    677
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    For example, Ext.form.field.Checkbox isn't required for Ext.form.FieldSet to be defined so uses is ok there.
    According to the requires doc, the Ext.form.field.Checkbox class should be required because it's needed when making an instance of Ext.form.FieldSet, so the the Ext.form.field.Checkbox class should be listed on the requires config... by my understanding.

  4. #4
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,295
    Answers
    16
    Vote Rating
    117
      1  

    Default

    I had applications hanging while loading when everything was using 'requires'. So now I use 'uses' as long that the required class is not needed in the constructor and things work must better.

  5. #5
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,412
    Answers
    20
    Vote Rating
    677
      -1  

    Default

    Quote Originally Posted by SebTardif View Post
    I had applications hanging while loading when everything was using 'requires'. So now I use 'uses' as long that the required class is not needed in the constructor and things work must better.
    I agree with this comment; however, it contradicts what Mitch was saying. The listed classes are used to construct the fieldset, so they should be listed on the requires config.

Similar Threads

  1. Replies: 2
    Last Post: 12 Apr 2015, 10:48 PM
  2. Replies: 4
    Last Post: 7 Jun 2013, 5:47 AM
  3. Replies: 2
    Last Post: 13 Apr 2012, 7:34 AM
  4. Replies: 0
    Last Post: 15 Apr 2011, 6:13 AM
  5. Replies: 0
    Last Post: 12 Dec 2010, 4:58 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
  •