Remote JSON won't load into dynatables, please correct me where am doing wrong

154 views Asked by At

I am trying to load remote JSON file into dynatables, but dynatables won't show any data.

here's my table

  <table class="table table-striped" id="myTable">
   <thead>
        <th>orgid</th>
        <th>uniqusers</th>
        <th>transacs</th>
        <th>traffic</th>
        <th>advthreats</th>
        <th>malware</th>
        <th>org_name</th>
        <th>domain</th>
        <th>partner</th>
</thead>
<tbody>
 </tbody>
</table>

and here's my script

$(document).ready(function() {
 $('#myTable').dynatable({
dataset: {
 ajax: true,
 ajaxOnLoad: true,
 ajaxUrl: 'betafile.json',
 records: []
 }
});
});

and JSON file data

{"records":     [{"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"412234    033129","advthreats":"28832","malware":"61","org_name":"Education       Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},   {"orgid":8140488,"uniqusers":"7","transacs":"13101121","traffic":"39907320    0170","advthreats":"13093","malware":"10","org_name":"Newham College    of Further Education","domain":"newham.ac.uk","partner":"iCritical"},     {"orgid":11621785,"uniqusers":"8","transacs":"56850","traffic":"1011450886     ","advthreats":"5","malware":"0","org_name":"Limerick Education      Centre","domain":"lec.ie","partner":"iCritical"},
{"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340     33129","advthreats":"28832","malware":"61","org_name":"Education     Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
{"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340     33129","advthreats":"28832","malware":"61","org_name":"Education     Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
{"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340     33129","advthreats":"28832","malware":"61","org_name":"Education       Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
 {"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340      33129","advthreats":"28832","malware":"61","org_name":"Education        Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
 {"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340      33129","advthreats":"28832","malware":"61","org_name":"Education              Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
{"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340      33129","advthreats":"28832","malware":"61","org_name":"Education       Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
 {"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340     33129","advthreats":"28832","malware":"61","org_name":"Education        Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
{"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340     33129","advthreats":"28832","malware":"61","org_name":"Education        Futures Group","domain":"vistacollege.edu","partner":"Teknas, Inc."},
  {"orgid":5529306,"uniqusers":"58","transacs":"11448173","traffic":"4122340      33129","advthreats":"28832","malware":"61","org_name":"Education       Futures Group","domain":"vistacollege.edu","partner":"Teknas,       Inctest."}],"queryRecordCount":"10","totalRecordCount":"12"} 

please help

1

There are 1 answers

0
Raphaël Rouckout On

Try change your thead data attributes, like this (it worked for me) :

<table class="table table-striped" id="myTable">
  <thead>
    <th data-dynatable-column="orgid">orgid</th>
    <th data-dynatable-column="uniqusers">uniqusers</th>
    <th data-dynatable-column="transacs">transacs</th>
    <th data-dynatable-column="traffic">traffic</th>
    <th data-dynatable-column="advthreats">advthreats</th>
    <th data-dynatable-column="malware">malware</th>
    <th data-dynatable-column="org_name">org_name</th>
    <th data-dynatable-column="domain">domain</th>
    <th data-dynatable-column="partner">partner</th>
  </thead>
  <tbody>
  </tbody>
</table>