Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8213347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:05:03+00:00 2026-06-07T11:05:03+00:00

I’m following miamicoder’s sencha touch 2 tutorial with great success (http://miamicoder.com/2012/how-to-create-a-sencha-touch-2-app-part-2/), however because I’m

  • 0

I’m following miamicoder’s sencha touch 2 tutorial with great success (http://miamicoder.com/2012/how-to-create-a-sencha-touch-2-app-part-2/), however because I’m still a newbie to this my javascript knowledge is restricting me some what.

What I want to do is call a javascript function stored in the controller but pass it local variables. Here’s my code thats declared in the initialize of one of my views:

var geo = Ext.create('Ext.util.Geolocation', {autoUpdate: false, listeners: {
            locationupdate: function(geo) {
                console.log('Got location: ',geo);
                findCurrentAddress(geo,"txtFrom");
            },
            //locationerror: {fn: this.onGotLocation, scope: this }
            locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {
                alert("deal with this later")
            }
        }
    });
    geo.updateLocation();

and then findCurrentAddress is defined as:

function findCurrentAddress(geo, txt){
  alert("do some stuff with the geo object");
}

How can I move this function over to the controller and still make it accessible to this view? Like what the tutorial does with the onNewButtonTap event on the link provided above.

The end result is the same, but I’d like to keep things clean but keeping functions out of the way.

I tried doing:

locationupdate: {fn: this.onGotLocation, scope: this }

and wiring the necessary code in the controller, which worked except I lose the the geo object with lat/long properties (at least, I dont know how to pass it!)

Any help/tips/pointers much appreciated! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:05:05+00:00Added an answer on June 7, 2026 at 11:05 am

    Why not fire and event from the view and subscribe to that event in your controller?

    something like this:

    ...
    locationupdate: function(geo) {
        console.log('Got location: ',geo);
        this.fireEvent('get_loc_update', geo); //this refers to your instance of Ext.util.Geolocation
    },
    ...
    

    and listen for your get_loc_update event in the controller (or whatever you call it), which will pass the geo object

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.