1. #1
    Sencha User KJedi's Avatar
    Join Date
    Feb 2008
    Location
    Ukraine, Mykolayiv
    Posts
    145
    Vote Rating
    1
    KJedi is on a distinguished road

      0  

    Question Using member functions to render the complex content

    Using member functions to render the complex content


    I need a component that shows info about offer. The best way i can thin of is to subclass the panel, create a template and set data for the panel. I achieved all that, but the template is not working as I'd like it to:
    Code:
    new Ext.XTemplate(
    	'<img src="{this.getImageUrl(images)}" width="120" height="120" />',
    	'<div>',
    		'<strong>€ {this.formatPrice(price)}</strong>',
    		'<span class="name">{name}</span>',
    		'<p>{description}</p>',
    	'</div>',
    	'<div class="info">',
    		'<span class="type">{this.renderType(isOffer, isPrivate)}</span>',
    		'<span class="type">{this.renderDistance(distance)}</span>',
    	'</div>', {
    		getImageUrl: function (images) {
    			return CJ.constants.DEFAULT_DEAL_IMAGE;
    		},
    		formatPrice: function (price) {
    			return price;
    		},
    		renderType: function (isOffer, isPrivate) {
    			if (isPrivate == 'false') {
    				return CJ.t('Business deal')
    			}
    			if (isOffer == 'true') {
    				return CJ.t('Offer');
    			}
    			return CJ.t('Search');
    		},
    		renderDistance: function (dist) {
    			return (dist - 0) + 'm';
    		}
    	})
    However it does not understand that I actually want to call a member function, not get the value if this.something variable.

    Is there a way to make it work as I want it to?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You need to surround it with square brackets:

    Code:
    {[this.renderType(isOffer, isPrivate)]}
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User KJedi's Avatar
    Join Date
    Feb 2008
    Location
    Ukraine, Mykolayiv
    Posts
    145
    Vote Rating
    1
    KJedi is on a distinguished road

      0  

    Default


    Is there any official documentation where I can see these options?
    I read everything about XTemplate, but did not find that.
    Also there is a problem in the code above. If you're passing values as parameter, you should use
    Code:
    {[this.renderType(values.isOffer, values.isPrivate)]}
    instead of
    Code:
    {[this.renderType(isOffer, isPrivate)]}

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi