0

I've got such json data

{ "aaData" : [
   [ { "field1" : "value11", "field2" : "value12", "field3" : "value13" },
     { "field1" : "value21", "field2" : "value22", "field3" : "value33" } ]
]}

How to load such data into datatable? My init function looks like this

var oTable1 = $('#usertable').dataTable({
    "sPaginationType": "bs_full",
    "bProcessing" : true,
    "sAjaxSource" : "loadusers.html" });

And in html

<table class="datatable table table-striped table-bordered" id="usertable">
                        <thead>
                            <th>Field1</th>
                            <th>Field2</th>
                            <th>Field3</th>
                        </thead>
                        <tbody></tbody>
                    </table>
lapots
  • 12,553
  • 32
  • 121
  • 242

1 Answers1

0

Have you considered using JQGrid? it can create nice table from JSON.

http://www.trirand.com/blog/ (check out the demo).

JF it
  • 2,403
  • 3
  • 20
  • 30
  • also - is this the same as what you are looking for? - http://stackoverflow.com/questions/1051061/convert-json-array-to-an-html-table-in-jquery – JF it Mar 03 '14 at 12:50