1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    11
    Vote Rating
    0
    biscuit314 is on a distinguished road

      0  

    Exclamation Problems with "Basic Function"

    Problems with "Basic Function"


    Things started well. I defined a couple of Basic Functions at the viewport level. I was able to call them using "this.funcname()"

    But, when I tried to add a third, no go. The drag/drop operation appeared to succeed, but the third function did not appear. I was able to add as many funcs as I want to Application or Controller, but dragging from either of these to Viewport failed in the same way.

    No problem, probably better at the Application level (in fact probably even better at the Controller level).

    But I have tried every combination of everything I can think of but simply cannot call the function. Every attempt gives me "undefined" or "not a function".

    I looked at the Touch YQL example and it seems simple: appname.app.funcname(). Nope. Nothing, not calls to Ext.getCmp(), not calls to varying depths of namespace/classname.

    Please help!

    (I've moved all the functionality into a separate file so this is less urgent - still curious)

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,087
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Could you give us a small example project that illustrates the problem?
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    11
    Vote Rating
    0
    biscuit314 is on a distinguished road

      0  

    Default


    There are two problems

    1) trying to add a third Basic Function to Viewport fails

    I can't reproduce this in any other project but the one where I first experienced it. That project is not exotic in any way, but something must have gone awry along the way.



    2) Calling Application or Controller "Basic Functions" Let's say I do the following:
    • create a brand new project (Ext 4.0)
    • set the Application name property to "foobar"
    • save the project as foobar.xds
    • drop a basic function to Application, set fn to "greet" and add "alert('hi');" to the code
    • drop a panel to Views, drop a button on the panel
    • add a "click" event handler to button
    From there how do I call greet() ?

    I tried
    • foobar.greet();
    • foobar.app.greet(); [as demonstrated in the YQL example project]
    • this.greet();
    Finally, if I drop a Conroller onto Controllers and name it "abc", then drag/drop the greet function onto abc, how do I call greet() from there?

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,087
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Quote Originally Posted by biscuit314 View Post
    From there how do I call greet() ?
    There have been a few changes in Sencha Touch during the betas as to how to invoke those methods on the application. I can verify this but I think foobar.app.greet() is correct.


    Quote Originally Posted by biscuit314 View Post
    Finally, if I drop a Conroller onto Controllers and name it "abc", then drag/drop the greet function onto abc, how do I call greet() from there?
    "from there" means what? You can access other controllers via this.getController('abc')
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 1