Results 1 to 3 of 3

Thread: Using Ext.require with wildcard

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2014
    Posts
    72
    Answers
    3

    Default Using Ext.require with wildcard

    According to the documentation, I should be able to use Ext.require() with a wildcard in order to load all of the classes from a specific folder:

    expressions : String/String[]
    The class, classes or wildcards to load.





    Either I don't understand what is meant by "wildcard" (which is entirely possible) or it just doesn't work.

    In the launch() function of Application this works:

    Code:
    Ext.require('MyApp.view.myfolder.MyView');
    This does not work. Nothing is loaded:
    Code:
    Ext.require('MyApp.view.myfolder.*');
    I completely understand the concept of loading only the classes I need and the Sencha Plugin does a great job of creating the appropriate requires[] arrays automatically. However, I have a specific need to preload classes that are not necessarily in a requires[] array in any of my application views or controllers. So rather than get into a discussion about why I am trying to do this, I simply would like to know if wildcards work or not. If it not then I'll figure out some other way to accomplish my design goal.

    I'm using Modern Toolkit 6.6.

  2. #2
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    The short answer is yes, they do work.

    The longer answer is, wildcards need some extra metadata to work. When you're using Cmd, it will generate a list of class names/file locations that allow wildcards to function. Without this, the client can't know what "foo.*" refers to, since it can't reasonably inspect the server for potential files to load in.

    So whether it can function depends on how you're building the app.

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2014
    Posts
    72
    Answers
    3

    Default

    I'm building the app with Sencha Cmd. Is there a property in app.json that I can configure to allow wild cards for a specific directory? The "classpath" property perhaps?

Similar Threads

  1. Wildcard includes
    By deliriousrhino in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 15 Aug 2013, 2:50 PM
  2. wildcard in this.control
    By deathgod86 in forum Sencha Touch 2.x: Discussion
    Replies: 1
    Last Post: 29 Apr 2013, 5:21 AM
  3. Replies: 3
    Last Post: 2 Jul 2012, 4:09 AM
  4. [CLOSED] Ext.require('*') wildcard not working
    By Di Peng in forum Ext:Bugs
    Replies: 4
    Last Post: 2 May 2012, 10:12 AM
  5. wildcard / multiple IDs
    By rmauser in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 20 May 2007, 12:44 PM

Posting Permissions

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