How to use pagination in dynamic column headers using ajax ?
How to use pagination in dynamic column headers using ajax ?
 datatestlord            
            
                Posts: 6Questions: 3Answers: 1
datatestlord            
            
                Posts: 6Questions: 3Answers: 1            
            i am using this code for dynamic column headers , but pagination is not working.
how to use pagination, scroll, and other editing using columndef part.
Please help.
https://datatables.net/forums/discussion/29260/dynamic-column-headers-via-ajax
$( document ).ready( function( $ ) {
    $.ajax({
            "url": 'data/arrays.txt',   // using my servlet here to return json with column headers
    "type": "POST",
            "success": function(json) {
                var tableHeaders;
                $.each(json.columns, function(i, val){
                    tableHeaders += "<th>" + val + "</th>";
                });
                $("#tableDiv").empty();
                $("#tableDiv").append('<table id="displayTable" class="display" cellspacing="0" width="100%"><thead><tr>' + tableHeaders + '</tr></thead></table>');
                //$("#tableDiv").find("table thead tr").append(tableHeaders);  
                $('#displayTable').DataTable(json);
            },
            "dataType": "json"
        });
});
This discussion has been closed.