Dynamic adding dataTable

Dynamic adding dataTable

alexcalexc Posts: 1Questions: 0Answers: 0
edited January 2011 in General
[code]$(document).ready(function(){
//$.ajaxSetup({async:false});
$.post("/inner.html",function(data){
$("#content").append("");
$("#example").html(data);
var tabl = $("#exapmle").dataTable();
//tabl.fnDraw();
//tabl.fnClearTable(tabl);
//tabl.fnAddData(data);
//tabl.fnReloadAjax("/inner.html");
},"html");

html


[/code]
Inner.html return formated (thead,tbody,tfoot) data
How adding dataTable to dynamic created ?

Replies

  • netmannetman Posts: 15Questions: 0Answers: 0
    edited January 2011
    You really need to READ the examples pages:
    http://datatables.net/examples/data_sources/ajax.html
    http://datatables.net/examples/data_sources/server_side.html

    Have some code to start with, based on the first example page above (You also need to read the example pages to go on though )


    [code]
    jQuery(document).ready(function($) {

    // Create The Statistics Table
    initMy_Table();
    /* Statistics Table Creation with Data Tables for JQuery */
    var My_Table;
    function initMy_Table() {

    My_Table = $('#example').dataTable( {
    "bProcessing": true,
    "sAjaxSource": 'g.php',
    "aoColumns": [
    /* Column1 */ { "bSearchable": false, "bVisible": false },
    /* Column2 */ { "bSortable": false, "bSearchable": false, "bVisible": true },
    /* Column3 */ { "bSortable": false, "bSearchable": false, "bVisible": true},
    /* Column4 */ { "bSortable": false, "bSearchable": false, "bVisible": true}

    } );
    }
    }

    [/code]

    Regards
    Steve
This discussion has been closed.