Readjust Table horizontally

Readjust Table horizontally

ilatineilatine Posts: 20Questions: 2Answers: 0

Hi All,

I was able to successfully implement ColVis on a table but I wanted to know if I could readjust the table as columns are being checked or unchecked. Is this possible?

$(document).ready(function(){
        $('#example').DataTable({       
        "sDom": 'C<"isaac">lfrtip'
        })

        getListItems('http://xxx.com/ICTT','IceCreamTrucks','complete', 'failure');
    });


function getListItems(url, listname, complete, failure) {

    // Executing our items via an ajax request
    $.ajax({
        url: url + "/_api/web/lists/getbytitle('" + listname + "')/items",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            complete(data); // Returns JSON collection of the results
        },
        error: function (data) {
            failure(data);
        }
    });
function complete(data) {

var tblData= $('#example').DataTable();

for(var i =0; i < data.d.results.length; i++) {
var tblData = $('#example').DataTable();

   var rowNode = tblData
    .row.add([ data.d.results[i].Title, data.d.results[i].Town, data.d.results[i].County, data.d.results[i].NumberOfTrucks ]).draw();
}


$("#dtData").append(tblData);


 alert("Completed successfully.");
 }
function failure(data) {
 alert("Operation failed.");
 }

}

Any ideas?

This discussion has been closed.