Edición de «Datagrid Simple y jquery»
De KumbiaPHP Framework Wiki
Advertencia: no has iniciado sesión. Tu dirección IP se hará pública si haces cualquier edición. Si inicias sesión o creas una cuenta, tus ediciones se atribuirán a tu nombre de usuario, además de otros beneficios.
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces guarda los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 1: | Línea 1: | ||
− | + | Partials para crear de forma simple un datagrid con php y algo de jquery | |
=== En el controlador === | === En el controlador === | ||
− | + | ||
<source lang="php"> | <source lang="php"> | ||
<?php | <?php | ||
Línea 18: | Línea 18: | ||
'Nombre' => 'nombre', | 'Nombre' => 'nombre', | ||
'Telefono' => 'telefono', | 'Telefono' => 'telefono', | ||
− | 'Direccion' => 'direccion'); | + | 'Direccion' => 'direccion')); |
} | } | ||
Línea 29: | Línea 29: | ||
/app/view/cliente/page.phtml | /app/view/cliente/page.phtml | ||
<source lang="php"> | <source lang="php"> | ||
− | <? View::partial('datagrid/ajax' | + | <? View::partial('datagrid/ajax'false,array('Model'=>$result, 'Campos'=>$campos)); ?> |
</source> | </source> | ||
Línea 42: | Línea 42: | ||
<link type="text/css" rel="stylesheet" href="http://www.datatables.net/release-datatables/media/css/demo_table.css" /> | <link type="text/css" rel="stylesheet" href="http://www.datatables.net/release-datatables/media/css/demo_table.css" /> | ||
<div id="datagrid"> | <div id="datagrid"> | ||
− | <table border="1px | + | <table border="1px" class="simple">" |
<thead><tr> | <thead><tr> | ||
<?php foreach( $Campos as $titulo => $valor): ?> | <?php foreach( $Campos as $titulo => $valor): ?> | ||
− | <th> <?php echo $titulo ? | + | <th> <?php echo $titulo >?</th> |
<?php endforeach; ?> | <?php endforeach; ?> | ||
</tr></thead> | </tr></thead> | ||
Línea 59: | Línea 59: | ||
</div> | </div> | ||
<script> | <script> | ||
− | $(function() { | + | $(document).ready(function() { |
− | $('# | + | $('#datagrid').dataTable(); |
} ); | } ); | ||
Línea 68: | Línea 68: | ||
''la pagina del autor del script para jquery es http://www.datatables.net/'' | ''la pagina del autor del script para jquery es http://www.datatables.net/'' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Categoría:Partials]] | [[Categoría:Partials]] | ||
− |