ExtJS XTemplate lets you use . in a for tag to loop through all the records in the store:
tpl: new Ext.XTemplate(
'<tpl for=".">',
'<div>{thing}</div>',
'</tpl>'),
I’d like to render a message instead if the set is empty (i.e. if the for loop is never entered). I’ve set allowEmptyStore: true.
How can I use an if statement to determine whether the store is empty. I’ve tried if("."), if(Ext.empty(.), and if(Ext.empty(this.myStore)). I’m guessing this is a fairly common thing to do with templates. What’s the magic syntax I’m missing?
The solution lies in the magic
valuesvariable. The following will be triggered if the underlying store is empty: