[eluser]ruizpi[/eluser]
I HAVE A PROBLEM WITH THIS COMPONENT. I WANT TO DO A SERVER SIDE GRID BUT IT DOESNT WORK.
MY VIEW IS:
<html >
<head>
<title><?php $titulo_pagina?></title>
<link rel="stylesheet" href="../css/misclases.css" type="text/css" />
<link rel="stylesheet" href="../../../css/demo_table.css" type="text/css" />
<link rel="stylesheet" href="../../../css/demo_page.css" type="text/css" />
[removed][removed]
[removed][removed]
[removed]
/* $(document).ready(function() {
$('#example').dataTable();
} );*/
// This is a very simple demo that shows how a range of elements can
// be paginated.
// The elements that will be displayed are in a hidden DIV and are
// cloned for display. The elements are static, there are no Ajax
// calls involved.
/**
* Callback function that displays the content.
*
* Gets called every time the user clicks on a pagination link.
*
* @param {int} page_index New Page index
* @param {jQuery} jq the container with the pagination links as a jQuery object
*/
$(document).ready(function()
{
$('#example').dataTable
({
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "<?php echo base_url();?>ethyria/listener",
"iDisplayStart" : 10,
"fnServerData": function(sSource, aoData, fnCallback)
{
$.ajax(
{
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
}
);
}
});
});
[removed]
</head>
<body>
<div id="Contenedor">
<div id="BarraIzq">
<img src='/images/logopine.png' border='0' width='150' height='60' alt='logopine.png (1.095 bytes)'>
<?php echo br(3);?>
<table align="center" class="MiTablaMenu">
<tr>
<td class="TDMenu"><font class="MiFuenteTituloMenu">MENU</font></td>
</tr>
<tr>
<td class="CeldaTransparente"><?php echo nbs(2);?></td>
</tr>
<tr>
<td class="TDMenu">
<?php
$Opcion1 = "TAGSMCR";
echo anchor('/ethyria/VerTagsMcr',"<button type='submit' class='MiBotonPine'>".$Opcion1."</button>", array('class' => 'SinSubrayadoEnlace'));
?>
</td>
</tr>
<tr>
<td class="TDMenu">
<?php
$Opcion1 = "OPCION 2";
echo anchor('/ethyria/VerTagsMcr',$Opcion1,array('class' =>'MiBotonPine'));
?>
</td>
</tr>
<tr>
<td class="TDMenu">
<?php
$Opcion1 = "OPCION 3";
echo anchor('/ethyria/VerTagsMcr',$Opcion1,array('class' =>'MiBotonPine'));
?>
</td>
</tr>
</table>
</div>
<div id="BarraSup">
<font class="MainFuente">Ethyria Web Access</font>
</div>
<div id="MarcoInterior">
<?php
if (isset($consulta))
{
echo "<table id='example' class='display'>";
echo "<thead>";
echo "<tr><th>Obra</th><th>Id</th><th>Tagno</th><th>IdSistema</th><th>Descripcion</th>".
"<th>Ubicación</th></tr>";
echo "</thead>";
echo "<tbody class='tipoletra'>";
echo "<tr>";
echo "<td colspan='5' class='dataTables_empty'>Loading data from server</td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
}
?>
</div>
</div>
</body>
</html>
MY CONTROLLER:
function VerTagsMcr()
{
/* $this->load->model('Ethmodel','',TRUE);
$data['consulta'] = $this->Ethmodel->SacaTagsMcr();
$this->load->view('v_view_menu',$data); */
$this->load->model('Ethmodel','',TRUE);
$data['consulta'] = $this->Ethmodel->SacaTagsMcr();
$this->load->view('v_view_menu',$data);
}
public function listener()
{
$table = "tagsmcr";
$columns = array("Obra","id", "IdSubSistema", "TagNo", "Descripcion","Ubicacion");
$index = "id";
$this->load->model("Datatables_model", "datatables");
echo $this->datatables->generate($table, $columns, $index);
}