title: How to put onClick in column of data tables?
body: <p>So, been trying to use datatable in reactjs, I want to put an onclick in the column but getting an error.</p>
  
  <p>Following is my code:</p>
  
  <pre><code>const $ = require('jquery')
  $.DataTable = require('datatables.net')
  class Rmsdatatable extends Component {
      constructor(props) {
          super(props)
          this.handletableclick = this.handletableclick.bind(this)
      }
      handletableclick(event) {
          console.log(event)
      }
      componentDidUpdate() {
          console.log(this.props.data)
          this.$el = $(this.el)
          this.$el.DataTable(
              {
                  data: this.props.data,
                  scrollY: 520,
                  paging: false,
                  responsive: true,
                  columns: [
                      {
                          data: "vfdSno",
                          render: function (data, type, row) {
                              return '&lt;a onClick={' + this.handletableclick.bind(this, row) + '} &gt;' + data + '&lt;/a&gt;'
                          }
                      },
                      { data: "customerName" },
                      { data: "district" },
                      { data: "state" }
                  ]
              }
          )
      }
      render() {
          return (
              &lt;div style={{ 'padding': '10px' }} className="col-xs-10"&gt;
                  &lt;table id="example" className="display" width="100%" ref={el =&gt; this.el = el}&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th&gt;VFD/Controller No&lt;/th&gt;
                              &lt;th&gt;Beneficiary&lt;/th&gt;
                              &lt;th&gt;District&lt;/th&gt;
                              &lt;th&gt;State&lt;/th&gt;
                          &lt;/tr&gt;
                      &lt;/thead&gt;&lt;/table&gt;
              &lt;/div&gt;
  
          )
      }
  }
  </code></pre>
  
  <p>For reference, I am using this link: </p>
  
  <p><a href="https://datatables.net/forums/discussion/38969/reload-refresh-table-after-event" rel="nofollow noreferrer">https://datatables.net/forums/discussion/38969/reload-refresh-table-after-event</a></p>
  
  <p>Error is : <code>TypeError: Cannot read property 'handletableclick' of undefined</code></p>
  
  <p>Thanks and appreciate your help.</p>