简体   繁体   English

隐藏ngx-datatable Ionic中的列

[英]Hide column in ngx-datatable Ionic

I'm new to NGX-datatable . 我是NGX-datatable的新手。 I have to populate my data table from Firebase in my ionic app. 我必须在离子应用程序中从Firebase填充数据表。 Given below is the format of JSON which is returned from the Firebase. 以下是从Firebase返回的JSON格式。

I want to know if I don't use the User_id as a column, how do I access the User_id in the row button click event? 我想知道是否不将User_id用作列,如何在行按钮单击事件中访问User_id? Or in the other hand, how can I use the User_Id as a column how to hide User_Id column. 或者,另一方面,如何使用User_Id作为列,如何隐藏User_Id列。 How can I achieve this? 我该如何实现?

{
User_id:data,
User_name:data
}

You can find here on how to toggle columns in ngx-datatable 您可以在此处找到有关如何切换ngx-datatable中的列的信息

toggle(col) {
    const isChecked = this.isChecked(col);
    if(isChecked) {
      this.columns = this.columns.filter(c => { 
        return c.name !== col.name; 
      });
    } else {
      this.columns = [...this.columns, col];
    }
  }

GITHUB DEMO GITHUB演示

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

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