Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82536

Get Row Data and Pass to my JavaScript Function

$
0
0

I am adding a view/Edit Button to each row of my table , On click i have to get the data and pass it to my javascript function , but unable to do so ,

Adding the button/links like this

 "columnDefs": [ {
        "targets": -1,
        "data": null,
        "defaultContent":
             '<a id="btn-view">View-</a>'
          +  '<a class="btn-edit">Edit</a>'
        } ]

   $('#allMemberTable tbody').on('click', '.btn-edit', function (e) {

      var data = table.row( $(this).parents('tr') ).data();
       console.log("data ="+data[0]);

       // Getting Row data scuccessfully
      test(data) ;   // This is not getting called ,   it is not recognizing this metod , giving error , test is not a function , i tried with this.test() , but same

   });

 // Getting Row data scuccessfully
      test(data) ;   // This is not getting called ,   it is not recognizing this metod , giving error , test is not a function , i tried with this.test() , but same

please correct me or give any other way around ( sorry for this basic question)

EDIT: Reformatted post using Markdown


Viewing all articles
Browse latest Browse all 82536

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>