|    
			
				16/01/2015, 09:10
			
			
			  | 
  |   |  |  |  Fecha de Ingreso: noviembre-2014 
						Mensajes: 8
					 Antigüedad: 10 años, 11 meses Puntos: 0 |  | 
  |  Respuesta: Como agregar un boton a uncanpo del datatables  
  Bueno es algo parecido solo que la estructura del codigo es distintaeste es el codigo que estoy utilizando.
 
 
 
 este es el codigo php de nombre process.php
 
 <?php
 if (isset($_POST['tag'])) {
 try {
 $conn = require_once 'connect.php';
 
 $sql = "SELECT p.Id as 'Id', p.Nombres as 'Nombres',p.Estado,p.PrimerApellido as 'PrimerApellido',p.SegundoApellido,DATE_FORMAT(FRO  M_DAYS(TO_DAYS(NOW())-TO_DAYS(FechaNac)), '%Y')+0 AS 'Edad',p.LeeEscribe,p.FechaNac as 'fecha nacido',p.Domicilio,p.Dui,e.Nombre as 'estadocivil',pro.Nombre as 'Profesiones',g.Nombre as 'Genero',m.Nombre as 'municipio',m.IdDpartamento,n.Nombre as 'nacionalidad' FROM persona as p INNER JOIN estadocivil as e on p.Idestadocivil=e.Id INNER JOIN profesiones as pro on p.IdProfesiones=pro.Id INNER JOIN genero as g on p.Idgenero=g.Id INNER JOIN municipio as m on p.Idmunicipio=m.Id INNER JOIN nacionalidad as n on p.IdNacionalidad=n.Id GROUP BY p.Id";
 $result = $conn->prepare($sql) or die ($sql);
 
 if (!$result->execute()) return false;
 
 if ($result->rowCount() > 0) {
 $json = array();
 while ($row = $result->fetch()) {
 $json[] = array(
 'Id' => $row['Id'],
 'Nombres' =>$row['Nombres'],
 'PrimerApellido' => $row['PrimerApellido'],
 'SegundoApellido' =>$row['SegundoApellido'],
 'LeeEscribe' =>$row['LeeEscribe'],
 'Domicilio' =>$row['Domicilio'],
 'estadocivil' =>$row['estadocivil'],
 'Profesiones' =>$row['Profesiones'],
 'Dui' =>$row['Dui'],
 
 'Genero' =>$row['Genero'],
 'Edad' =>$row['Edad'],
 'municipio' =>$row['municipio'],
 'nacionalidad' =>$row['nacionalidad'],
 'Estado' =>$row['Estado'],
 
 );
 }
 
 $json['success'] = true;
 echo json_encode($json);
 }
 } catch (PDOException $e) {
 echo 'Error: '. $e->getMessage();
 }
 }
 
 ?>
 
 
 este es el el archivo js de nombre function.js
 
 $(document).ready(function() {
 $.ajax({
 url: './include/process.php',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'json',
 success: function (data) {
 if (data.success) {
 $.each(data, function (index, record) {
 if ($.isNumeric(index)) {
 var row = $("<tr />");
 $("<td />").text(record.Id).appendTo(row);
 $("<td />").text(record.Nombres).appendTo(row);
 $("<td />").text(record.PrimerApellido).appendTo(row);
 $("<td />").text(record.SegundoApellido).appendTo(row);
 $("<td />").text(record.LeeEscribe).appendTo(row);
 $("<td />").text(record.Domicilio).appendTo(row);
 $("<td />").text(record.estadocivil).appendTo(row);
 $("<td />").text(record.Profesiones).appendTo(row);
 $("<td />").text(record.Dui).appendTo(row);
 $("<td />").text(record.Genero).appendTo(row);
 $("<td />").text(record.Edad).appendTo(row);
 $("<td />").text(record.municipio).appendTo(row);
 $("<td />").text(record.nacionalidad).appendTo(row);
 $("<td />").text(record.Estado).appendTo(row);
 
 row.appendTo("table");
 }
 })
 }
 
 $('table').dataTable({
 "bJQueryUI": true,
 "sPaginationType": "full_numbers"
 })
 }
 });
 })
 
 y esta es la pajina index don de lo muestro
 
 <!doctype html>
 <html lang="es">
 <head>
 <meta charset="UTF-8">
 <title>Datatables PHP PDO, jQuery y MySQL</title>
 <link href="css/style.css" type="text/css" rel="stylesheet"/>
 <link href="css/jquery-ui.css" type="text/css" rel="stylesheet"/>
 <link href="css/datatables.css" type="text/css" rel="stylesheet"/>
 
 <script src="js/jquery.js"></script>
 <script src="js/jquery-ui.js"></script>
 <script src="js/datatables.js"></script>
 <script src="js/functions.js"></script>
 </head>
 <body>
 <header>
 <h1>DPERSONAS REGISTRADAS EN EL SISTEMA    </h1>
 </header>
 <section>
 <table>
 <thead>
 <tr>
 <th>Id</th>
 <th width="109">Nombres </th>
 <th width="112">Primer Apellido</th>
 <th width="120">Segundo Apellido</th>
 <th width="86">Lee Escribe</th>
 <th width="107">Domicilio</th>
 <th width="73">Estado civil</th>
 <th width="100">Profesiones</th>
 <th width="86">Dui</th>
 <th width="78">Genero</th>
 <th width="41">Edad</th>
 <th width="86">Municipio</th>
 <th width="105">Nacionalidad</th>
 <th width="105">Estado</th>
 
 </tr>
 </thead>
 </table>
 </section>
 
 </body>
 </html>
     |