简体   繁体   English

在extjs中有条件地在网格中显示/隐藏列

[英]show/hide column in grid conditionally in extjs

I have grid in my application, I need to show/hide particular column conditionally. 我的应用程序中有网格,我需要有条件地显示/隐藏特定的列。 Please help me. 请帮我。

Code: 码:

{
    header: 'Type',  dataIndex: 'mirror',  flex: 1, sortable: true,
    renderer: function (value, meta, record, rowIndex, colIndex, store) {
                    if(value == '')
                        return "-";
                    else
                        return value;
            }
}

currently it shows - incase no records,but I need to remove column incase no record found. 当前它显示-万一没有记录,但是如果没有记录,我需要删除列。

Columns have a hide method which you can use. 列具有可以使用的hide方法。 For example, take a look at this example that show you how to hide an specific column in runtime. 例如,看一下这个示例该示例向您展示如何在运行时隐藏特定的列。

If you want to hide/show a the column depending on a condition, you have to evaluate that condition and use the hide & show methods. 如果要根据条件hide/show列,则必须评估该条件并使用hideshow方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM