Results 1 to 6 of 6

Thread: Load views on fly instead of entire app at once

  1. #1
    Sencha User
    Join Date
    Sep 2016
    Posts
    23
    Answers
    1

    Default Load views on fly instead of entire app at once

    Hello,

    I'm a bit confused about ExtJs concept. Somewhere I saw, that there is possible to make it load only required views for that times and if (for instance) you click in menu on Users, only then that Users view and additional data would be loaded. It's useful for large application...

    I managed to get this working by not adding views into any 'requires'. I get warning message, but after I click in menu on 'Users', via FireBug I see that this view and other required data are loaded only then and not before. However, then I commit code to the server and test it remotely, this is not working and the only way to make it work is to add views into 'requires'.

    Looks like the problem is that app is adding keyword 'widget' from out of blue :o and URL looks like this:
    http://www.myapp.com/widget/appName/view/users/User.js instead of
    http://www.myapp.com/app/view/users/User.js


    Could you tell me, is it possible to achieve what I'm looking for and what is the right way to do that? (I work via Visual Studio, without ExtJs template so no Sencha CMD)


    Thank you in advance!

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Using 'requires' statements is the standard way to let the compiler know where the code is. Perhaps you could use the requires so that the code is defined, and only instantiate the view when it is needed?

  3. #3
    Sencha User
    Join Date
    Sep 2016
    Posts
    23
    Answers
    1

    Default

    If I add view into 'requires' it will be automatically downloaded to the client after he visits the web page (http://myExtJsApp.com), even if that view is not initialized at that time. My goal is that view would be only downloaded when client clicks in menu on ie.: Users.

    Maybe I wasn't clear enough about that, hope so now is better Is there a way to achieve that?

  4. #4
    Sencha User
    Join Date
    Sep 2016
    Posts
    23
    Answers
    1

    Default

    Looks like it was my fault. I excluded one file before committing code and forgot about it. However, I still would like to understand best practice how to make views downloaded to the client only then that particular view is needed (for example, when client clicks on record in menu and that one view would be sent to him and loaded).

    As I said, if I don't add view to the 'requirements' I get warning message (below), but also I get what I want: view file (for example: UserForm.js) is downloaded for a client only then it's needed.
    [W] [Ext.Loader] Synchronously loading 'MyApp.view.UserForm'; consider adding Ext.require('MyApp.view.UserForm') above Ext.onReady
    Is this is a good practice or there is a better one?

  5. #5
    Sencha User
    Join Date
    Sep 2016
    Posts
    23
    Answers
    1

    Default

    Bump. Really would like to know that, as at the moment I'm building a prototype for company I'm working for. My English is not super, so if there is something not very clear let me now!

  6. #6
    Sencha User
    Join Date
    Apr 2013
    Posts
    914
    Answers
    105

Similar Threads

  1. Load different views with different buttons
    By blozzy in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 14 Sep 2015, 11:32 AM
  2. Load url of entire website in sencha touch 2
    By huberte in forum Sencha Touch 2.x: Q&A
    Replies: 7
    Last Post: 30 Oct 2012, 7:26 PM
  3. load entire carousel, not on demand
    By kortovos in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 11 Oct 2010, 11:18 PM
  4. How to load entire application after completion of some configuration activities
    By livinglegends in forum Ext 3.x: Help & Discussion
    Replies: 15
    Last Post: 27 Sep 2010, 1:27 AM

Tags for this Thread

Posting Permissions

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