Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/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
Javascript extjs 4.2.1 GridPanel-在模板列中显示/隐藏链接_Javascript_Templates_Extjs_Gridpanel - Fatal编程技术网

Javascript extjs 4.2.1 GridPanel-在模板列中显示/隐藏链接

Javascript extjs 4.2.1 GridPanel-在模板列中显示/隐藏链接,javascript,templates,extjs,gridpanel,Javascript,Templates,Extjs,Gridpanel,我的gridpanel中有一个包含URL的模板列: { xtype: 'templatecolumn', tpl: Ext.create('Ext.XTemplate', '<a href="#" class="x-leave-request-edit">Edit</a>' ) } 这个很好用。但问题是,默认情况下,我希望tpl中的链接不可见 我怎样才能做到这一点 我尝试在onRender()、afterRender()和fini

我的
gridpanel
中有一个包含URL的模板列:

{
    xtype: 'templatecolumn',
    tpl: Ext.create('Ext.XTemplate',
        '<a href="#" class="x-leave-request-edit">Edit</a>'
    )
}
这个很好用。但问题是,默认情况下,我希望
tpl
中的链接不可见

我怎样才能做到这一点


我尝试在
onRender()
afterRender()
finishRender()
中使用类似的代码,但是
Ext.query()
总是返回一个空数组。

您可以使用以下命令来代替所有
query
丑陋的命令:

item.down('.x-leave-request-edit')

要使其最初不可见,只需添加
display:none在内联样式中

return '<a href="#" style="display: none;" class="x-leave-request-edit">Edit</a>';
返回“”;

由于某些原因,item.down('.x-leave-request-edit')调用不起作用。我也尝试了item.down('a.x-leave-request-edit')。Web Inspector说:TypeError:“undefined”不是函数(计算“item.down('a.x-leave-request-edit'))。另一方面,添加显示的解决方案:无;做谢谢。啊,应该是
Ext.fly(item).down()
return '<a href="#" style="display: none;" class="x-leave-request-edit">Edit</a>';