Last active
August 29, 2015 14:02
-
-
Save abelrgr/e87b157e9ae738a5938d to your computer and use it in GitHub Desktop.
ejemplo basico Ignited Datatables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- vista paises_datatables --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script type="text/javascript" src="<?php echo base_url('public/js/jquery.js') ?>"></script> | |
<script type="text/javascript" src="<?php echo base_url(). 'public/js/jquery.dataTables.min.js' ?>"></script> | |
<link rel="stylesheet" href="<?php echo base_url(). 'public/css/jquery.dataTables.min.css' ?>"> | |
</head> | |
<body> | |
<table id="example" class="display"> | |
<thead> | |
<tr> | |
<th>id</th> | |
<th>iso</th> | |
<th>name</th> | |
<th>Printable name</th> | |
<th>edit</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td>loading...</td> | |
</tr> | |
</tbody> | |
</table> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#example').dataTable({ | |
"processing": true, | |
"serverSide": true, | |
"ajax": { | |
"url": "<?php echo site_url('/paises/ajax') ?>", | |
"type": "POST" | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> | |
<!-- controlador paises --> | |
<?php | |
public function listado() | |
{ | |
$this->load->view('paises_datatables'); | |
} | |
public function ajax() | |
{ | |
$this->load->library('datatables'); | |
$this->datatables->select('id,iso,name,printable_name')->from('country')->add_column('edit', '<a href="profiles/edit/$1">EDIT</a>', 'id'); | |
echo $this->datatables->generate(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment