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 7846205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:30:03+00:00 2026-06-02T17:30:03+00:00

Hi I use sencha touch 2 and have some problems with Ext.XTemplate. When I

  • 0

Hi I use sencha touch 2 and have some problems with Ext.XTemplate.

When I use next template and it work right:

var template = new Ext.XTemplate(
    '<div title="{currentLocation:this.tr}">',
        '<img src="styles/css/img/locate.png" height="30px" width="30px" />',
    '</div>',
    {
        compiled: true,
        tr: function(value) {
            return 'translated ' + value;
        }
    }
);

template.apply({currentLoaction: 'Current location'});

<div title="Current Location">
    <img src="styles/css/img/locate.png" height="30px" width="30px" />
</div>

But I prefer set 'Current location' variable in template, but it doesn’t work right ({\'Current location\':this.tr} return empty value):

var template = new Ext.XTemplate(
    '<div title="{\'Current location\':this.tr}">',
        '<img src="styles/css/img/locate.png" height="30px" width="30px" />',
    '</div>',
    {
        compiled: true,
        tr: function(value) {
            return 'translated ' + value;
        }
    }
);

template.apply();

<div title="">
    <img src="styles/css/img/locate.png" height="30px" width="30px" />
</div>

I try use this.tr(currentLocation) and this.tr(\'Current location\') instead currentLocation:this.tr and \'Current location\':this.tr, but then template return <div title=" in both cases.

Can anybody explain what I doing wrong and how I can resolve my problem?

  • 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-02T17:30:05+00:00Added an answer on June 2, 2026 at 5:30 pm

    Arbitrary code can be executed if enclosed in square brackets, see Ext.XTemplate. So in your example:

    var template = new Ext.XTemplate(
        '<div title="{[this.tr(\'Current location\')]}">',
            '<img src="styles/css/img/locate.png" height="30px" width="30px" />',
        '</div>',
        {
            compiled: true,
            tr: function(value) {
                return 'translated [' + value + ']';
            }
        }
    );
    
    document.write(template.apply());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With Sencha Touch, i want to use some of the icons in the directory
I have an app that has several different pages that use Sencha Touch. Ocassionally
I'm new to Sencha Touch have a bit of an issue. Quite simply I've
I am starting to use Sencha Touch and have already read their Getting Started
I have a page that I would like to use some sencha items on
I am new bee to sencha touch. I have started with few samples and
I am new in phonegap development environment and i want to use Sencha touch
I am new to Sencha Touch 2 and I want to have something like:
My Setup Safari 5.1.2 (Macintosh) Sencha Touch 1.1 The Issue The process I have
I'm developing a Sencha Touch application in which I'm doing lots of Ext.extend and

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.