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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:30:32+00:00 2026-06-04T16:30:32+00:00

I need to render a template in sencha in mvc pattern , so on

  • 0

I need to render a template in sencha in mvc pattern , so on InitComponent i have declared some variable but i am unable to acess those variable outside init function . I did following try

Ext.define('casta.view.Intro', {
    extend: 'Ext.tab.Panel',
    //alias: 'widget.currentDate', //this makes it xtype 'currentDate'
    //store: 'CurrentDateStore',


    initComponent: function(){
        this.planetEarth = { name: "Earth", mass: 1.00 };

        this.tpl = new Ext.Template(['<tpl for".">', '<p> {name} </p>', '</tpl>'].join(''));
        this.tpl.compile();
        this.callParent(arguments);

    },
    html:this.tpl.apply(this.planetEarth)
});

ERROR

this.tpl is undefined
[Break On This Error]   

html:this.tpl.apply(planetEarth)
  • 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-04T16:30:34+00:00Added an answer on June 4, 2026 at 4:30 pm

    I’m pretty sure that is not how JavaScript scoping works…

    In your example there are 2 ways to do what you would want to do:

    //this is the bad way imo, since its not really properly scoped.
    // you are declaring the planeEarth and tpl globally
    // ( or wherever the scope of your define is. )
    var plantetEarth = { name: "Earth", mass: 1.00 }
    var tpl = new Ext.Template(['<tpl for".">', '<p> {name} </p>', '</tpl>'].join(''));
    tpl.compile();
    Ext.define('casta.view.Intro', {
        extend: 'Ext.tab.Panel',
        //alias: 'widget.currentDate', //this makes it xtype 'currentDate'
        //store: 'CurrentDateStore',
    
    
        initComponent: function(){
    
            this.callParent(arguments);
    
        },
        html:tpl.apply(planetEarth)
    });
    

    or

    //I would do some variation of this personally.
    //It's nice and neat, everything is scoped properly, etc etc
    Ext.define('casta.view.Intro', {
        extend: 'Ext.tab.Panel',
        //alias: 'widget.currentDate', //this makes it xtype 'currentDate'
        //store: 'CurrentDateStore',
    
    
        initComponent: function(){
    
            this.tpl = new Ext.Template(['<tpl for".">', '<p> {name} </p>', '</tpl>'].join(''));
            this.tpl.compile();
            this.tpl.apply(this.planetEarth);
            this.html = this.tpl.apply(this.planetEarth)
            this.callParent(arguments);
    
        },
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im need render this remplate with Rails.root <%= escape_javascript(render(:template => '#{Rails.root}/app/controllers/posts/repost_new'))%> but I get
I have a workflow where I need to render an exception page. But this
I have a report which is composed of several subreports. I need to render
I need to compare the performances of a Flask application that uses jinja2.Template.render against
I have the following g:render tag in a gsp page: <g:render template=/artist/rate model='[artistID: 1,
I want to render some json data using HTML template. I haven't started implementing
When you render_to_template you pass dictionary of different items the template need to render
I need to run render a mako template stored in a string in a
I need to render a partial view to a string within a controller action.
I need to render a 1027 * 768 bitmap to the client window (same

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.