Ver Mensaje Individual
  #8 (permalink)  
Antiguo 02/07/2013, 15:26
Avatar de Reedyseth
Reedyseth
 
Fecha de Ingreso: enero-2009
Ubicación: Chihuahua, México
Mensajes: 419
Antigüedad: 15 años, 3 meses
Puntos: 36
Respuesta: mostrar y ocultar fila de tabla con jquery

Mira aquí hice un ejemplo para ver si se amplía la idea

http://behstant.com/tutorials/exampl...jQuery_V2.html

Y el código fuente cambio a esto:

Código HTML:
Ver original
  1. <!DOCTYPE>
  2.     <head>
  3.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4.         <title>Jquery load with content and effect.</title>
  5.         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  6.         <script type="text/javascript">
  7.             jQuery(function($) {
  8.                 $("#report tr:odd").addClass("odd");
  9.                 $("#report tr:not(.odd)").hide();
  10.                 $("#report tr:first-child").show();
  11.                 // código anterior
  12.                 /*$("#report tr.odd div.arrow").click(function(){
  13.                     $(this).parent().parent().next("tr").toggle();
  14.                     $(this).parent().find(".arrow").toggleClass("up");
  15.                 });*/
  16.  
  17.                 $('.arrow').toggle(function() {
  18.                     $(this).removeClass('arrow-plus');
  19.                     $(this).addClass('arrow-minus');
  20.                     $('#report tr:eq(2)').show();
  21.                 },function() {
  22.                     $(this).removeClass('arrow-minus');
  23.                     $(this).addClass('arrow-plus');
  24.                     $('#report tr:eq(2)').hide();
  25.                 });
  26.             });
  27.         </script>
  28.         <style type="text/css">
  29.             body { font-family:Arial, Helvetica, Sans-Serif; font-size:0.8em;}
  30.             #report { border-collapse:collapse;}
  31.             #report h4 { margin:0px; padding:0px;}
  32.             #report img { float:right;}
  33.             #report ul { margin:10px 0 10px 40px; padding:0px;}
  34.             #report th { background:#7CB8E2; color:#fff; padding:7px 15px; text-align:left;}
  35.             #report td { background:#C7DDEE; color:#000; padding:7px 15px; }
  36.             #report tr.odd td { background:#fff; cursor:pointer; }
  37.             #report div.arrow { background:transparent url(arrows.png) no-repeat scroll 0px -16px; width:16px; height:16px; display:block;background-color: #9E0AAF;}
  38.             #report div.up { background-position:0px 0px;}
  39.             div.iconset-01 a{ background-image: url('http://img9.imageshack.us/img9/4589/6qj.png'); background-repeat: no-repeat;}
  40.             .arrow-plus {background-position: 0px 0px; width:30px;height:30px;display: block;margin:5px 0;}
  41.             .arrow-minus {background-position: -40px 0px; width:30px;height:30px;display: block;margin:5px 0;}
  42.         </style>
  43.     </head>
  44.     <body>
  45.         <div class="iconset-01">
  46.             <a class="arrow arrow-plus" href="#"></a>
  47.         </div>
  48.         <table id="report">
  49.             <tr>
  50.                 <th>Codigo</th>
  51.                 <th>Descripción</th>
  52.                 <th>Precio</th>
  53.                 <th>Unidad</th>
  54.                 <th></th>
  55.                 <th></th>
  56.             </tr>
  57.             <tr>
  58.                 <td>D35AC010</td>
  59.                 <td>PINTURA PLÁSTICA COLOR</td>
  60.                 <td>5,38</td>
  61.                 <td>m2</td>
  62.                 <td><div class="arrow"></div></td>
  63.                 <td>
  64.                       <a href="#" onclick="javascript:agregarPartida('D35AC010','PINTURA PLÁSTICA COLOR','5,38','m²');"><img id="apartida0" src="http://www.presupueston.com/images/precios/apartida.png"></a>
  65.                 </td>
  66.             </tr>
  67.             <tr>
  68.                 <td colspan="6">
  69.                     <h4>Additional information</h4>
  70.                         m². Pintura plástica color lisa PROCOLOR mix o similar en paramentos verticales y horizontales, lavable dos manos, i/lijado y emplastecido.
  71.                     </td>
  72.             </tr>
  73.         </table>
  74.     </body>
  75. </html>
__________________
Reedyseth
Te ayudo? No olvides dar un +
blog:http://behstant.com/blog
En el blog:Tutoriales de Desarrollo Web PHP, Javascript, BD y más.