【问题标题】:Get value of another column in an ant.design Table's column?获取 ant.design 表列中另一列的值?
【发布时间】:2017-12-09 00:51:54
【问题描述】:

在我的 react 和基于 ant.design 的应用程序中,我有一个包含以下列的表格。

const tableColumns = [{
      title : 'Lorem',
      dataIndex : 'lorem'
      render: text => <a href='#'> {text + ipsum} </a>
    }, {
      title : 'Ipsum',
      dataIndex : 'ipsum'
    }];

我想为ipsum 使用值,即第一列渲染函数内每一行的第二列。 ant.design 在此处获取第二列值的最佳推荐方法是什么?

【问题讨论】:

    标签: javascript arrays reactjs antd


    【解决方案1】:

    render 函数的第二个参数是当前记录:

    render: (text, row) => <a> {text + row.ipsum} </a>
    

    https://ant.design/components/table/#Column

    【讨论】:

    • 非常感谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-03
    • 2022-06-23
    • 1970-01-01
    • 2021-09-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-06
    相关资源
    最近更新 更多