title: Grab row data onclick of a field in material-table
body: <pre><code>import MaterialTable from &quot;material-table&quot;;
  import ShipmentContext from &quot;../context/ShipmentContext&quot;;
  
  const ItemsTable: React.FC = () =&gt; {
    const shipmentcontext = useContext(ShipmentContext);
  
    const { filtered } = shipmentcontext.State;
  
    return (
      &lt;&gt;
        &lt;div style={{ width: &quot;100%&quot;, overflowY: &quot;hidden&quot; }}&gt;
          &lt;MaterialTable
              options={{
              search: false,
              showTitle: false,
              toolbar: false,
              paging: false,
              padding: &quot;dense&quot;,
              maxBodyHeight: &quot;400px&quot;,
              minBodyHeight:&quot;400px&quot;,
              paginationType: &quot;stepped&quot;,
              tableLayout: &quot;fixed&quot;
            }}
            columns={[
              { title: &quot;AWB NUMBER&quot;, field: &quot;awbno&quot; ,},
              { title: &quot;TRANSPORTER&quot;, field: &quot;carrier&quot; },
              { title: &quot;SOURCE&quot;, field: &quot;from&quot; },
              { title: &quot;DESTINATION&quot;, field: &quot;to&quot; },
              { title: &quot;BRAND&quot;, field: &quot;carrier&quot; },
              { title: &quot;START DATE&quot;, field: &quot;pickup_date&quot; },
              { title: &quot;ETD&quot;, field: &quot;&quot; },
              {
                title: &quot;STATUS&quot;,
                field: &quot;current_status&quot;,
                cellStyle: {
                  color: &quot;green&quot;,
                },
              },
            ]}
            data={filtered}
          /&gt;
        &lt;/div&gt;
      &lt;/&gt;
    );
  };
  
  export default ItemsTable;
  </code></pre>
  <p>I want to gather the data of the field i clicked on the row.As here the data is dynamic i am unable to make an onClick method to grab the object which is clicked in the row.</p>
  <p>My table look like this :</p>
  <p><a href="https://i.stack.imgur.com/orCFd.png" rel="nofollow noreferrer">table</a></p>
  <p>I want an onClick method which when i click on any AWB number grabs the data of it</p>