javascript - Sencha touch - Ext.XTemplate if/else not working -


hi new sencha touch. have problem displaying data in ext.dataview.list itemtpl. how setting itemtpl in config

itemtpl: new ext.xtemplate(              '<div class="featureimageholder"><img class="featureimage" src="{itemimage}" alt="{itemname}" /></div>',              '<span class="item">',                 '<h3 class="salename">{itemname}</h3>',                 '<span class="priceoptions">',                 '<tpl for="prices">',                     '<span class="priceoptionreg">',                         '<tpl if="priceoptiondesc">{priceoptiondesc}</tpl> ',                         '<tpl if="priceoptionreg">{priceoptionreg}</tpl>  ',                         '<tpl if="pricereg">${pricereg}</tpl>  ',                         '<tpl if="priceregsuffix">{priceregsuffix}</tpl> ',                     '</span>',                     '<tpl if="pricesale"><span class="priceoptionsale">',                         '<tpl if="pricesaledesc">{pricesaledesc}</tpl> ',                         '<tpl if="priceoptionsale">{priceoptionsale}</tpl>  ',                         '<tpl if="pricesale">${pricesale}</tpl>',                         '<tpl if="pricesalesuffix">{pricesalesuffix}</tpl> ',                     '</span></tpl>',                 '</tpl>',                 '</span>',             '</span>',             '<div class="clear"></div>'         ), 

it working , displaying list of products. need change css class first record because ad banner. using following if statement:

itemtpl: new ext.xtemplate(                 '<tpl if={isbanner} === true>',                     '<div class="mytestclass">{itemimage}</div>',                  '<tpl elseif={isbanner} === false>',                     '<div class="featureimageholder"><img class="featureimage" src="{itemimage}" alt="{itemname}" /></div>',                 '</tpl>',                   '<span class="item">',                     '<h3 class="salename">{itemname}</h3>',                     '<span class="priceoptions">',                     '<tpl for="prices">',                         '<span class="priceoptionreg">',                             '<tpl if="priceoptiondesc">{priceoptiondesc}</tpl> ',                             '<tpl if="priceoptionreg">{priceoptionreg}</tpl>  ',                             '<tpl if="pricereg">${pricereg}</tpl>  ',                             '<tpl if="priceregsuffix">{priceregsuffix}</tpl> ',                         '</span>',                         '<tpl if="pricesale"><span class="priceoptionsale">',                             '<tpl if="pricesaledesc">{pricesaledesc}</tpl> ',                             '<tpl if="priceoptionsale">{priceoptionsale}</tpl>  ',                             '<tpl if="pricesale">${pricesale}</tpl>',                             '<tpl if="pricesalesuffix">{pricesalesuffix}</tpl> ',                         '</span></tpl>',                     '</tpl>',                     '</span>',                 '</span>',                 '<div class="clear"></div>'             ), 

the problem if/elseif both executed each record. if use if/else gives error in console.

uncaught syntaxerror: unexpected token else  

you can see have used

'<tpl if={isbanner} === true>',

i have used

'<tpl if={isbanner} == true>', 

i have tried many varients comparing numeric values instead of boolean , using &gt; or &lt;. tried comparing string values. variations, if/elseif both executing , if/else gives error.

any appreciated, need change class first record.

if isbanner boolean, work

'<tpl if="isbanner">',      '<div class="mytestclass">{itemimage}</div>', '<tpl else>',      '<div class="featureimageholder"><img class="featureimage" src="{itemimage}" alt="{itemname}" /></div>', '</tpl>', 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -