javascript - Put a button in front of all rows in jQuery DataTables -


i using jquery datatables. being populated json data database. can't figure out how display button or link in front of each record. want make when user clicks on button particular record gets added in database, button or link should contain id. please sort out problem. below code i'm using:

var otable = $('#jsontable').datatable();  $.ajax({   url: 'process.php?method=fetchdata',   datatype: 'json',   success: function(s) {     console.log(s);     otable.fncleartable();     (var = 0; < s.length; i++) {       otable.fnadddata([         s[i][3],         s[i][4],         s[i][0], // contains id       ]);     }   },   error: function(e) {     console.log(e.responsetext);   } }); 
<table id="jsontable" class="display table table-bordered" cellspacing="0" width="100%">   <thead>     <tr>       <th>class number</th>       <th>subject</th>       <th>add</th>     </tr>   </thead> </table> 

i hope help

otable = $('#jsontable').datatable({                  "fnrowcallback": function (nrow, aadata, idisplayindex) {  					//nrow		row object  					//aadata	param  					//idisplayindex	row index  					$('td:eq(0)', nrow).html("<input type='button'>button</input>");                      return nrow;                  }          });


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -