Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 在XTemplate中显示空数据的错误消息_Extjs - Fatal编程技术网

Extjs 在XTemplate中显示空数据的错误消息

Extjs 在XTemplate中显示空数据的错误消息,extjs,Extjs,ExtJS XTemplate允许您在for标记中使用循环浏览存储中的所有记录: tpl: new Ext.XTemplate( '<tpl for=".">', '<div>{thing}</div>', '</tpl>'), tpl:new Ext.XTemplate( '', “{thing}”, ''), 如果集合为空(即,如果从未输入for循环),我希望呈现一条消息。我已经设置了allowEmptyStore:

ExtJS XTemplate允许您在
for
标记中使用
循环浏览存储中的所有记录:

tpl: new Ext.XTemplate(
    '<tpl for=".">',
    '<div>{thing}</div>',
    '</tpl>'),
tpl:new Ext.XTemplate(
'',
“{thing}”,
''),
如果集合为空(即,如果从未输入for循环),我希望呈现一条消息。我已经设置了
allowEmptyStore:true


如何使用if语句确定存储是否为空。我已经尝试过
if(“.”
if(Ext.empty(.)
,和
if(Ext.empty(this.myStore))
。我猜这是一种非常常见的模板操作。我缺少的神奇语法是什么?

解决方案在于magic
value
变量。如果底层存储为空,将触发以下操作:

'<tpl if="!(values && values.length)">',
...
'</tpl>',
”,
...
'',

解决方案在于magic
values
变量。如果基础存储为空,将触发以下操作:

'<tpl if="!(values && values.length)">',
...
'</tpl>',
”,
...
'',