Ver Mensaje Individual
  #11 (permalink)  
Antiguo 12/01/2014, 17:52
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Añadir estilo a unas filas.

OK, he cambiado esto de posición:

Código Javascript:
Ver original
  1. $("#data tbody").append(fila);
  2. $('.carga').html('');


Código Javascript:
Ver original
  1. $.each(data, function(i,item){
  2.  
  3.  
  4. var fila = document.createElement("tr"),
  5.     contenido = [
  6.                   item.id_aviso, item.telefonos,
  7.                   item.name + ' ' + item.apellidos, item.calle,
  8.                   item.localidad, item.aparatos, item.marcas, item.facturacion
  9.                 ];
  10.  
  11. if (data === 1){
  12.     fila.style.background = "#f00";
  13.     fila.style.color = "#fff";
  14. }
  15.  
  16. for (i = 0, limite = contenido.length; i < limite; i++){
  17.     var columna = document.createElement("td");
  18.     columna.innerHTML = contenido[i];
  19.     fila.appendChild(columna);
  20.    
  21. }
  22.  
  23.  
  24.  
  25.  $("#data tbody").append(fila);
  26.  $('.carga').html('');
  27.    
  28.  
  29.  
  30.  
  31.  });  
  32. }
  33.  
  34.    if(fila == '')
  35.     fila = '<tr><td colspan="4" align="center">No se encontraron registros..</td></tr>';


Y esta parte como la pongo?

Código HTML:
Ver original
  1. html_user += '<tr onclick="pulsar1(this, ' + *String.fromCharCode(39) + item.id_aviso + String.fromCharCode(39) *+ ');" ondblclick="pulsar(this, ' + String.fromCharCode(39) + item.id_aviso + String.fromCharCode(39) *+ ');" >';
  2. html_user += '<td style="'+item.style+'"><input name="demo" type="checkbox" value="' + item.id_aviso + '"/></td>';