How does the Dropdown component in antd get the data for a column in the current row of the Table component?

problem description

in Table component column render has a Dropdown component, which is composed of several buttons under
Dropdown component. The official example given by
is to render the a tag to the row directly, so that you can get the data directly.
but I want to get the data of the current line when I click the button in the drop-down menu of a row for other operations.
I tried to extract the Dropdown component to encapsulate a separate Operation component, which can achieve the problem of passing values, but is there a more concise way not to re-wrap the layer?

as shown in the following figure: the action column is a drop-down menu with an execute button below,
clipboard.png

Name
clipboard.png

the example is here: https://codesandbox.io/s/nr5q.

in the example, the method I use is as follows:

  columns = [
    {
      title: "Name",
      dataIndex: "name",
      key: "name",
      render: text => <a href="javascript:;">{text}</a>
    },
    {
      align: "center",
      title: "",
      dataIndex: "name",
      key: "operation",
      render: text => {
        // rendertextOperationtext
        return <Operation text={text} handleShowModal={this.showModal} />;
      }
Mar.23,2022

this is concise enough, because whether you pass parameters or not, you need to render the drop-down buttons that operate that column, and you split the components, which is reasonable enough not to write a lot of things in the render function. As for passing values, I think there is nothing wrong with adding a piece of data to this component.


{

  align: "center",
  title: "",
  dataIndex: "name",
  key: "operation",
  render: text => {
    // rendertextOperationtext
    return <Operation handleShowModal={() => this.showModal(text)} />;
  }

The render render function of


Column takes three parameters, the second of which is the data of the current row

{
  align: "center",
  title: "",
  dataIndex: "name",
  key: "operation",
  render: (text,record,index) => {
    return <Operation text={text} handleShowModal={this.showModal(record)} />;
  }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e533e6-437ca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e533e6-437ca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?