returns in the first column undefined undefined
returns in the first column undefined undefined
Hello, I'm trying to insert any datatable editor into my json in this format:
And returns in the first column undefined undefined...
{"iTotalRecords":0,"iTotalDisplayRecords":0,"data":[
{"id":1,"descricaoReceita":"Receita 1","dataReceita": "year":2015,"month":"FEBRUARY","dayOfMonth":10,"dayOfWeek":"TUESDAY","era":"CE","dayOfYear":41,"leapYear":false,"monthValue":2,"chronology":{"id":"ISO","calendarType":"iso8601"}},"valorReceita":1000.00,"receitaFixa":false,"receitaFixaQuantidade":1,"receitaFixaTempo":"SEMANAS","repetirLancReceita":false,"repetirPorPeriodo":"SEMANAL","pagamento":false,"addObservacao":"","tipoReceitas":[],"minhasContas":[{"id":4,"nome":"Contas 4","dataAcesso":{"year":2017,"month":"APRIL","dayOfMonth":1,"dayOfWeek":"SATURDAY","era":"CE","dayOfYear":91,"leapYear":false,"monthValue":4,"chronology":{"id":"ISO","calendarType":"iso8601"}},"saldoAnterior":0.00,"saldoAtual":3456.00,"saldoFinal":3652.00,"tipo":"POUPANCA","cor":"#q8qwe5","dashBoard":false}],"etiquetas":[{"id":8,"nome":"Etiqueta 8","minhasReceitas":null}],"cor":"rgb(240, 50, 0, 1)"},{"id":18,"descricaoReceita":"Receita 18","dataReceita":{"year":2015,"month":"JULY","dayOfMonth":2,"dayOfWeek":"THURSDAY","era":"CE","dayOfYear":183,"leapYear":false,"monthValue":7,"chronology":{"id":"ISO","calendarType":"iso8601"}},"valorReceita":456.00,"receitaFixa":false,"receitaFixaQuantidade":1,"receitaFixaTempo":"ANOS","repetirLancReceita":false,"repetirPorPeriodo":"MENSAL","pagamento":false,"addObservacao":"","tipoReceitas":[],"minhasContas":[{"id":1,"nome":"Contas 1","dataAcesso":{"year":2017,"month":"JANUARY","dayOfMonth":1,"dayOfWeek":"SUNDAY","era":"CE","dayOfYear":1,"leapYear":false,"monthValue":1,"chronology":{"id":"ISO","calendarType":"iso8601"}},"saldoAnterior":0.00,"saldoAtual":5600.00,"saldoFinal":2520.00,"tipo":"POUPANCA","cor":"#5d4aas","dashBoard":false}],"etiquetas":[{"id":1,"nome":"Etiqueta 1","minhasReceitas":null}],"cor":"rgb(52, 24, 01, 0.8)"}]}
This question has an accepted answers - jump to answer
Answers
I don't understand your problem description. However your JSON string doesn't seem to be in a valid format. You can test it here: https://jsonlint.com/
Kevin
Json is valid yes, I tested before sending. Now does other tests here without console has this error: TypeError: f is undefined [Learn more] jquery.dataTables.min.js:
Folloe the setup:
`<script type="text/javascript">
var editor; // use a global for the submit and return data rendering in the examples
And table:
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>id</th>
<th>Descrição</th>
<th>Data</th>
<th>Conta</th>
<th>Tipo</th>
<th>Valor</th>
</tr>
</thead>
<tfoot>
<tr>
<th>id</th>
<th>Descrição</th>
<th>Data</th>
<th>Conta</th>
<th>Tipo</th>
<th>Valor</th>
</tr>
</tfoot>
</table>
<table class="table table-hover dataTable table-striped w-full"
id="receitasTable">
<thead>
<tr>
<th>id</th>
<th>Descrição</th>
<th>Data</th>
<th>Etiquetas</th>
<th>Conta</th>
<th>Tipo</th>
<th>Valor</th>
</tr>
</thead>
</table>
I was able to view the data here
When I copy the above JSON into jsonlinit I get the following error:
Which is this at the beginning of the JSON string:
Maybe there was a problem when you pasted it into the thread?
Maybe you can use the debugger to provide the full JSON response. Also it is helpful if you can format you code blocks using triple ticks (```).
Are you loading jQuery?
Kevin
I was able to load successfully, thanks