Ver Mensaje Individual
  #5 (permalink)  
Antiguo 12/02/2010, 05:57
petete2007
 
Fecha de Ingreso: marzo-2008
Mensajes: 17
Antigüedad: 16 años, 8 meses
Puntos: 0
Respuesta: datatable llamada por parametro

solucion!!

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico" />
		
		<title>Panel de administraci&oacute;n</title>
		<style type="text/css" title="currentStyle">
			@import "./media/css/demo_page.css";
			@import "./media/css/demo_table.css";
		</style>
		<link href="jquery.tab.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" language="javascript" src="./media/js/jquery.js"></script>
		<script type="text/javascript" language="javascript" src="./media/js/jquery.dataTables1.js"></script>
		<script type="text/javascript" charset="utf-8">

$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback )
{
	if ( typeof sNewSource != 'undefined' )
	{
		oSettings.sAjaxSource = sNewSource;
	}
	this.oApi._fnProcessingDisplay( oSettings, true );
	var that = this;
	
	oSettings.fnServerData( oSettings.sAjaxSource, null, function(json) {
		/* Clear the old information from the table */
		that.oApi._fnClearTable( oSettings );
		
		/* Got the data - add it to the table */
		for ( var i=0 ; i<json.aaData.length ; i++ )
		{
			that.oApi._fnAddData( oSettings, json.aaData[i] );
		}
		
		oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
		that.fnDraw( that );
		that.oApi._fnProcessingDisplay( oSettings, false );
		
		/* Callback user function - for event handlers etc */
		if ( typeof fnCallback == 'function' )
		{
			fnCallback( oSettings );
		}
	} );
}

	var oTable;							
	$(document).ready(function() {										
		oTable = $('#example').dataTable( {
			"bFilter": false,         /* ocultar buscador */
			"sSearch":false,
			"iDisplayLength": 1,
			"iDisplayStart": 0,
			"aoColumns": [ 
				{ "bVisible": false, "asSorting": [ "asc" ] },  
				{ "sWidth": "50%", "bSortable": false , "bSearchable": false},   /* foto */
				{ "sWidth": "50%", "bSortable": false , "bSearchable": false},  /* detalle */
				{ "bVisible": false},
				{ "bVisible": false},
				{ "bVisible": false}
				],					
			"bProcessing": true,
			"sPaginationType": "full_numbers",  
			/* "bServerSide": true,   */
			"sAjaxSource": "./server_catalog.php"
		} );


	$('#boton1').click( function () {
		/* Example call to load a new file */
		oTable.fnReloadAjax( './server_catalog_p.php' );
		/* Example call to reload from original file */
		//oTable.fnReloadAjax();	
	} );

	$('#boton2').click( function () {
		/* Example call to reload from original file */
		oTable.fnReloadAjax( './server_catalog.php' );	
	} );	



});
		
			
		</script>
	</head>
	<body id="dt_example1">

<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
	<tbody>
		<tr>
			<td colspan="6" class="dataTables_empty">Cargando datos del servidor...</td>
		</tr>
	</tbody>
</table>


<a href="#" id="boton1"> boton1</a>
<a href="#" id="boton2"> boton2</a>
	</body>
</html>