jquery - Datatables not displaying first column -
i have json object trying display in table using jquery datatables first column not showing. know data in json object data not displaying. can see problem code please? thanks!
<script src="jquery-3.2.1.min.js"></script> <script src="xlsx.full.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.15/datatables.min.css" /> <script type="text/javascript" src="https://cdn.datatables.net/r/bs-3.3.5/jqc-1.11.3,dt-1.10.8/datatables.min.js"></script> <meta charset="utf-8"> <a href="index.html"> <img border="0" src="home.png" width="50" height="50"> </a> <style> .pull-right{float:right!important;} .pull-left{float:left!important;} </style> <script> /* set xmlhttprequest */ function asyncreq(callback){ var url = "licenciamentos_projectos.xlsx"; var oreq = new xmlhttprequest(); oreq.open("get", url, true); oreq.responsetype = "arraybuffer"; oreq.onload = function(e) { var arraybuffer = oreq.response; /* convert data binary string */ var data = new uint8array(arraybuffer); var arr = new array(); (var = 0; != data.length; ++i) arr[i] = string.fromcharcode(data[i]); var bstr = arr.join(""); /* call xlsx */ var workbook = xlsx.read(bstr, { type: "binary" }); /* workbook here */ var sheet_name = workbook.sheetnames[2]; /* worksheet */ var worksheet = workbook.sheets[sheet_name]; var oficios = xlsx.utils.sheet_to_json(worksheet,{range:2}); callback(oficios); } oreq.send(); } asyncreq(function(result){ console.log(result); //datatable $('#tabela-oficios').datatable( { "dom": '<"pull-left"f><"pull-right"l>tip', "aadata": result, "aocolumns": [ { "mdata": "conc.", sdefaultcontent: ''}, { "mdata": "nº pt", sdefaultcontent: ''}, { "mdata": "procº ", sdefaultcontent: ''}, { "mdata": "designação", sdefaultcontent: ''}, { "mdata": "clausulas (s/n)", sdefaultcontent: ''}, { "mdata": "nº oficio", sdefaultcontent: ''}, { "mdata": "sgd", sdefaultcontent: ''}, { "mdata": "data oficio", sdefaultcontent: ''}, { "mdata": "data resposta", sdefaultcontent: ''}, { "mdata": "informação para resolução clausulas", sdefaultcontent: ''}, { "mdata": "data inf da ao resolução clausulas", sdefaultcontent: ''}] }); }); </script>
<h1 align="center">licenciamentos</h3> <h3 align="center">registo de oficios que carecem de resposta</h3> <table id="tabela-oficios" class="display compact" style="text-align:center; margin: 0 auto;" > <thead> <tr> <th>conc.</th> <th>nº pt</th> <th>número processo</th> <th>designação</th> <th>clausulas (s/n)</th> <th>nº oficio</th> <th>sgd</th> <th>data oficio</th> <th>data resposta</th> <th>informação para resolução clausulas</th> <th>data inf da ao resolução clausulas</th> </tr> </thead> </table>
Comments
Post a Comment