HTML Table SBadmin Bootstrap From JSON

I am trying to build a table from JSON but it is not loading the data properly . I want pagination in the table . I tried to followed the format from SB Admin Bootstrap but it fails to load any data .

My HTML Code is :–

<div class="dataTable_wrapper">
 <table class="table table-striped table-bordered table-hover" id="agents">
  <thead>
    <tr>
     <th> employeeNumber</th>
     <th> fullName</th>
     <th>employeeEmail</th>
     <th>jobTitle</th>
     <th>deptNo</th>
     <th>deptName</th>
     <th>managerEmail</th>
     <th>managerId</th>
     <th>managerName</th>
     <th>assignmentLastModifiedBy</th>
     <th>assignmentLastModifiedDate</th>
     <th>country</th>
     <th>theatre</th>
     <th>paymentAnalyst</th>
     <th>commDateFrom</th>
    </tr>
   </thead>
  </table>
</div>

My Script is :–

<script>
  $(document).ready(function() {
  $('#agents').dataTable( {
  "ajax": 'http://localhost:8080/TestQuartz/json/agent.json'
    } );
    } );
</script>  

My JSON File is :–

{"agent":[{"country":"AUS","employeeNumber":"397142","assignmentLastModifiedBy":null,"assignmentLastModifiedDate":null,"paymentAnalyst":"Khoo, T","fullName":"ABC","theatre":"ASIA","managerId":"249058","commDateFrom":"2015-06-15 00:00:00.0","deptName":"Global Virtual Sales - ","managerName":"Turner, J","jobTitle":"VIRTUAL SALES ACCOUNT ","managerEmail":"ert","deptNo":"115331063","employeeEmail":"bre"},{"country":"DEU","employeeNumber":"196091","assignmentLastModifiedBy":null,"assignmentLastModifiedDate":null,"paymentAnalyst":"Hatlak, T","fullName":"Gros, S","theatre":"EURO","managerId":"52367","commDateFrom":"2006-11-01 00:00:00.0","deptName":"Global Virtual Sales - Germany HQ","managerName":"Mer, W","jobTitle":"TERRITORY BUSINESS MANAGER.III.SALES.XYZ","managerEmail":"wme","deptNo":"515031281","employeeEmail":"sim"},{"country":"FIN","employeeNumber":"598401","assignmentLastModifiedBy":null,"assignmentLastModifiedDate":null,"paymentAnalyst":"Hatlak, T","fullName":"Kur, Es","theatre":"EURO","managerId":"144218","commDateFrom":"2011-10-01 00:00:00.0","deptName":"EU SS Geo Finland OTHER","managerName":"Lunt, Tha","jobTitle":"CLIENT SERVICES MANAGER.II.SERVICE SALES.XYZ","managerEmail":"tlu","deptNo":"561038082","employeeEmail":"eku"},{"country":"USA","employeeNumber":"399411","assignmentLastModifiedBy":null,"assignmentLastModifiedDate":null,"paymentAnalyst":"Spaulding, S,"fullName":"Hen, Cr Jo","theatre":"US","managerId":"153592","commDateFrom":"2015-06-22 00:00:00.0","deptName":"Michigan Select","managerName":"Wil, Sc A","jobTitle":"SYSTEMS ENGINEER-C.II.SALES.XYZ","managerEmail":"sco","deptNo":"020230434","employeeEmail":"cra"}]}

Can anyone help me with it ?

Regards.


Source: html5

Leave a Reply