lunes, 21 de mayo de 2012

jQuery: DataTables test edicion dinamica

var giCount = 1;
var  oTable;

$(document).ready(function() {
    oTable = $('#example').dataTable({
        "aaData": [
            [ "Webkit", "Safari 2.0", "OSX.4+", 419.3, "A" ],
            [ "Webkit", "Safari 3.0", "OSX.4+", 522.1, "A" ]
        ]
    
    });
  
 console.log(oTable);
} );
 
function fnClickAddRow() {
    oTable.fnAddData( [
        giCount+".1",
        giCount+".2",
        giCount+".3",
        giCount+".4",
        giCount+".5" ] );
     
    giCount++;
}


 function redibujarTabla(){
   var arrDatos = [
               [ "Trident", "Internet Explorer 6.0", "Win 98+", 6, "A" ],
            [ "Trident", "Internet Explorer 7.0", "Win XP SP2+", 7, "A" ]
        ];
   
   console.log(arrDatos);
   oTable.fnClearTable();   
   
   
   for(var i=0;i<arrDatos.length;i++){
      console.log(arrDatos[i]);
     oTable.fnAddData(arrDatos[i]);
   }     
  
 }  


function vaciarTabla(){
     oTable.fnClearTable();   
  }

function cambiarDatos(){
     oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, 0 ); // Row
   
  }

function recargarDatos(){
   // fnReloadAjax()
 }

Test Online:
http://live.datatables.net/ikoxog/6/edit

No hay comentarios:

Publicar un comentario