I want to create a dynamically variating list with XTemplates. unfort. you can't pass the index-id though a function within an if-construct like
var newItemTpl = '<div class="list_websites_item"><div class="' + cmp.id + '">' + orgItemTpl + '</div>' + '<div class="iconset">' +
'<tpl if="Ext.getCmp(\'' + cmp.id + '\').plugins[0].isPendingItem({[xindex-1]})">'+
'<p>IS PENDING</p>'+
'</tpl>' +
'</d开发者_开发技巧iv></div>';
when I call isPendingItem({[xindex-1]}) with argument I get the error
SyntaxError: Parse error
So how could I pass arguments here?
thnx!!!
You can access the in-built template variables (xindex, xcount, values etc) directly within an if tag so if you change your code to remove the enclosing '{[]}' then it should work:
var newItemTpl = '<div class="list_websites_item"><div class="' + cmp.id + '">' +
orgItemTpl + '</div>' + '<div class="iconset">' +
'<tpl if="Ext.getCmp(\'' + cmp.id + '\').plugins[0].isPendingItem(xindex-1)">'+
'<p>IS PENDING</p>'+
'</tpl>' +
'</div></div>';
精彩评论