Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81917

Trying to Load JSON on DataTable

$
0
0

Hi!

I'm trying to use a JSON to load datatable rows, but the datatable always return me a error, that is: DataTables warning: table id=dt_basic - Requested unknown parameter 'id' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4

I get this JSON from the InitComplete function from another datatable e save the result on sessionStorage. Like this:

"initComplete": function (settings, json) {
sessionStorage.setItem('json', json);
}

The JSON returns me:

[{"id":"36566","nomeFantasia":"LOJAO DOS ALUMINIOS","titulo":"Ajuda para gerar e corrigir arquivo do Sped Fiscal","codigoPrograma":"9220","nome":"ALANO","status":"Aberto","dataAbertura":"11-12-2017 00:00","motivo":"Comercial"}]

my columns configuration is:

"aoColumns": [
{"data": "id"},
{"data": "nomeFantasia"},
{"data": "titulo"},
{"data": "codigoPrograma"},
{"data": "nome"},
{"data": "status"},
{"data": "dataAbertura"},
{"data": "motivo"},
{"data": function (data) {
if (data.status == 'Fechado') {
return '<a style="width: 100%" class="btn btn-primary btn-sm" title="Trâmite" id="editChamado" href="#ajax/chamados-edit.php?id=' + data.id + '&st=0"><i class="fa fa-edit"></i></a>'
} else {
return '<a style="width: 45%" class="btn btn-primary btn-xs" title="Trâmite" id="editChamado" href="#ajax/chamados-edit.php?id=' + data.id + '&st=1"><i class="fa fa-edit"></i></a><a style="margin-left: 5%; width: 45%;" title="Fechar" id="deleteChamado" href="#ajax/chamados-delete.php?id=' + data.id + '&acao=delete" class="btn btn-success btn-xs"><i class="fa fa-check"></i></a>';

                            }
                        }
                    }
                ]

my table:

Chamado Nome Fantasia Título Codigo Rotina Atendente Status Data Abertura Motivo Ação

Please, anyone send me a ligth!
Thank you!


Viewing all articles
Browse latest Browse all 81917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>