Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to populate data table with dynamic column header and column data, I can populate dynamic column data successfully, but I can't achieve dynamic column...

I am using JSON array.

My html code is:

 <body>
    <table id="example" class="display" cellspacing="0" width="100%" border="1">
    </table>
 </body>

My JavaScript code is.

  <script>
  var JSONResult = '{
     "column1":"data1",
     "column2":"data2",
     "column3":"data3",
     "columnN":"dataN"}';
  var row_dtable = new Array();
  var dtable_api = $('#example').dataTable();
  $.each(JSONResult , function(key, value) {
         row_dtable.push(value);
       }); 
  dtable_api.api().row.add( row_dtable ).draw( false );   
  </script>
share|improve this question
    
How this is GIS related? – Jonatas Walker Jun 17 at 16:18
    
I am developing this application in ol3, resultant column will get from geojson file. – Priyanka Jun 20 at 4:19
    
what errors or issues do you get? – nmtoken Oct 7 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.