Results 1 to 4 of 4

Thread: How to use variable in tpl ?

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    78
    Answers
    1

    Default How to use variable in tpl ?

    How can we use a variable value in tpl (of Ext.view.View) which is not coming from store?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,450
    Answers
    3997

    Default

    Ext.view.View needs a store to apply the data to the tpl.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    78
    Answers
    1

    Default

    I have used store also but the case is that some of the data come from store and some I want to provide from variable. For example, here I want to give src of img from a variable but I don't know how can I specify variable inside tpl?
    Code:
    	var a = Ext.create('Ext.view.View', {
    			store: mystore,
    			tpl: ['<tpl for=".">',
    					 '<div  class="Thumb"> <img  vspace="5" src="'+ imagepath+ '" title="{name}"><p>{image}</p></div>',
    					 '</tpl>', ],
    					 and so on

  4. #4
    Ext JS Premium Member
    Join Date
    Feb 2008
    Posts
    17

    Default

    Quote Originally Posted by new2extjs View Post
    I have used store also but the case is that some of the data come from store and some I want to provide from variable. For example, here I want to give src of img from a variable but I don't know how can I specify variable inside tpl?
    Code:
    	var a = Ext.create('Ext.view.View', {
    			store: mystore,
    			tpl: ['<tpl for=".">',
    					 '<div  class="Thumb"> <img  vspace="5" src="'+ imagepath+ '" title="{name}"><p>{image}</p></div>',
    					 '</tpl>', ],
    					 and so on�
    I would also like to know if this is possible.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •