Griddle Tables:React:Visible设置为false而不在列元数据中工作?

时间:2016-10-04 16:10:49

标签: reactjs griddle

https://github.com/GriddleGriddle/Griddle

  

反应的Griddle表

列属性设置为visible = 'false',无效。有没有人为此修复或解决?

const columnMeta = [
    {
     'columnName': 'Date Submitted',
      customComponent: CustomDateComponent
    }
    {
      'columnName':'Action',
      'sortable':false,
      'visible':false
    }
  ];

1 个答案:

答案 0 :(得分:0)

我通过这个平底锅找到了解决方案:     https://jsfiddle.net/inillie/m374gnxd/

 var TestTable = React.createClass({
  getInitialState: function() {
    return {
      test: [{
        firstName: "Foo",
        lastName: "Bar",
        userId: "foo",
        someStuff: "SCIEN"  
      }]
    };
  },
  render: function() {
    return ( < div >
      < Griddle results = {
        this.state.test
      }
      columnMetadata = {
        columnMeta
      }
      columns = {
        ['firstName', 'lastName', 'someStuff']
      }
      /> < /div>
    );
  }
});

基本上,您可以在Griddle渲染中使用名为columns的自定义属性来确保显示哪些列。