1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    43
    Answers
    1
    Vote Rating
    0
    indapublic is on a distinguished road

      0  

    Default Answered: Call Controller function outside Ext namespace

    Answered: Call Controller function outside Ext namespace


    Hello, everyone.
    I want to call controller method in <script> section in index.html. Can I do it and how?
    Thanks for advice

  2. Resolved (by using gloval variable App)

  3. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    43
    Answers
    1
    Vote Rating
    0
    indapublic is on a distinguished road

      0  

    Default


    Resolved (by using gloval variable App)

  4. #3
    Sencha User
    Join Date
    Feb 2010
    Posts
    82
    Answers
    2
    Vote Rating
    0
    dobberph is on a distinguished road

      0  

    Default


    Can you give an example please?
    I have the same problem.

    Thanks.

  5. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    43
    Answers
    1
    Vote Rating
    0
    indapublic is on a distinguished road

      0  

    Default


    Hello! Of course.

    index.html

    Code:
    ...
    <link href="resources/css/main.css" media="screen" rel="stylesheet" type="text/css">
        <script id="microloader" type="text/javascript" src="sdk/microloader/development.js"></script>
        <script type="text/javascript">
            var
                g_App = undefined,
    ....
    app.js

    Code:
    ...
    launch: function() {
            // Destroy the #appLoadingIndicator element
            Ext.fly('appLoadingIndicator').destroy();
            
            g_App = this;
            
            // Initialize the main view
        },
    ...
    And run, for example:

    Code:
    g_App.getController('News').LoadData();

  6. #5
    Sencha User
    Join Date
    Feb 2010
    Posts
    82
    Answers
    2
    Vote Rating
    0
    dobberph is on a distinguished road

      0  

    Default


    Thansk a lot.

  7. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    12
    Answers
    1
    Vote Rating
    0
    dbabyak is on a distinguished road

      0  

    Default


    Doesn't work for me, the global variable remains undefined while assigned one's scope is launch() function

    <myAppName>.app.getControllerInstances()['<controllerName>'] does the job though

  8. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    43
    Answers
    1
    Vote Rating
    0
    indapublic is on a distinguished road

      0  

    Default


    Can you attach your unworking project?

  9. #8
    Sencha User
    Join Date
    Jul 2012
    Posts
    12
    Answers
    1
    Vote Rating
    0
    dbabyak is on a distinguished road

      0  

    Default


    Irrelevant now, got it working apparently. Thanks for your reply.

Thread Participants: 2

Tags for this Thread