javascript - Issue on Loading Dynamic Data to "DataTables" Using jQuery -


demo

i using this solution load dynamic data in data table. have use array of array since getting dynamic data user on font end selection (no database selection). using following code upload data table

<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="example"></table> 

and js:

$(document).ready(function () {     var counter = 0;     var comparetable = [];     var comparerow = [];     var check = "test";     var compmodelname = "test";     var selectedtype = "test";     var selectedtarget = "test";     var selectedror = "test";     var selectedspecies = "test";     var historicdis = "test";     var projectsnumber = "test";     var projectscost = "test";     var projectsroads = "test";     var projectspowerline = "test";     var projectspenstock = "test";     var mapshow = "test";      $("#load").on("click", function () {         loader();     });      function loader() {         comparerow.push(check);         comparerow.push(compmodelname);         comparerow.push(selectedtype);         comparerow.push(selectedtarget);         comparerow.push(selectedror);         comparerow.push(selectedspecies);         comparerow.push(historicdis);         comparerow.push(projectsnumber);         comparerow.push(projectscost);         comparerow.push(projectsroads);         comparerow.push(projectspowerline);         comparerow.push(projectspenstock);         comparerow.push(mapshow);     }      $('#example').datatable( {         "data": comparetable,         "columns": [             { "title": "compare" },              { "title": "model name" },             { "title": "model type" },             { "title": "energy target" },             { "title": "ror attribute" },             { "title": "species", "class": "center" },             { "title": "disturbance", "class": "center" },             { "title": "projects" },             { "title": "cost (m$)" },             { "title": "roads (km)" },             { "title": "powerlines (km)", "class": "center" },             { "title": "penstock (m)", "class": "center" },             { "title": "map" }          ]     } );        }); }); 

but can see in demo not functioning when click on "#load". can please let me know why happening , how can fix it?


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -